-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample4.py
43 lines (27 loc) · 939 Bytes
/
Example4.py
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
'''
Created on 11. 2. 2018
@author: Hanka
'''
print ("CALCULATOR\n")
repeat_calculation = True
while repeat_calculation:
a = int(input("Enter first integer: "))
b = int(input("Enter second integer: "))
print ("Operation Numbers")
print ("1 - total")
print ("2 - difference")
print ("3 - product")
print ("4 - quotient")
math_operation = int(input("Enter Operation Number: "))
if (math_operation == 1):
print ("%d + %d = %d" %(a, b, a+b))
elif (math_operation == 2):
print ("%d - %d = %d" %(a, b, a-b))
elif (math_operation == 3):
print ("%d * %d = %d" %(a, b, a*b))
elif (math_operation == 4):
print ("%d / %d = %.1f" %(a, b, a/b))
else:
print ("Invalid choice")
repeat_calculation = int(input("Do you want to continue? [yes = 1, no = 0]: "))
input("\nPress any key...")