-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc_Sid.py
More file actions
32 lines (28 loc) · 1.07 KB
/
Copy pathcalc_Sid.py
File metadata and controls
32 lines (28 loc) · 1.07 KB
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
from first import *
def calculating():
while True:
print(
"I can perform addition, subtraction, division and multiplication. What do you intend to "
"perform?\nOr press 'q' to exit the calculator.\n----------------------")
s = input("Please type the initials for the operation: ").lower()
if s == 'q':
print('I hope you enjoyed this!')
quit()
else:
try:
x = int(input("Please enter the first number of your choice: "))
y = int(input("Please enter the second number of your choice: "))
if s == 'a':
add(x, y)
elif s == 's':
sub(x, y)
elif s == 'm':
mul(x, y)
elif s == 'd':
div(x, y)
else:
print("\n[WARNING] Please enter correct initial!\n")
except ValueError:
print('\n[WARNING] Please enter a number!\n')
if __name__ == '__main__':
calculating()