-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator
73 lines (73 loc) · 1.79 KB
/
calculator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
print("Hello!")
print("I can divide and multiplicate values.")
print("If you want to divide values write: / ")
print("If you want to multiplicate values write: * ")
qes = input("What do you want to do? ")
if qes == "Division":
try:
x = int(input("First value: "))
except ValueError:
print("You wrote not value!")
x = 0
try:
y = int(input("Second value: "))
except ValueError:
print("You wrote not value!")
y = 0
try:
solv = x / y
except ZeroDivisionError:
print("You wrote zero!")
else:
print(x / y)
elif qes == "division":
try:
x = int(input("First value: "))
except ValueError:
print("You wrote not value!")
x = 0
try:
y = int(input("Second value: "))
except ValueError:
print("You wrote not value!")
y = 0
try:
solv = x / y
except ZeroDivisionError:
print("You wrote zero!")
else:
print(x / y)
elif qes == "/":
try:
x = int(input("First value: "))
except ValueError:
print("You wrote not value!")
x = 0
try:
y = int(input("Second value: "))
except ValueError:
print("You wrote not value!")
y = 0
try:
solv = x / y
except ZeroDivisionError:
print("You wrote zero!")
else:
print(x / y)
elif qes == "Multiplication":
x = int(input("First value: "))
y = int(input("Second value: "))
solv = x*y
print (solv)
elif qes == "multiplication":
x = int(input("First value: "))
y = int(input("Second value: "))
solv = x*y
print (solv)
elif qes == "*":
x = int(input("First value: "))
y = int(input("Second value: "))
solv = x*y
print (solv)
else:
print("Oh... There are some troubles!")