forked from Prothymos/Better-Simple-Python-Calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
27 lines (23 loc) · 656 Bytes
/
app.py
File metadata and controls
27 lines (23 loc) · 656 Bytes
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
def calc():
''' This is a functiion which when called, perform calculation tasks which user wants '''
num1 = float(input("Enter first number: "))
op = input("Enter operator: ")
num2 = float(input("Enter second number: "))
if op == "+" :
print(num1 + num2)
elif op == "-" :
print(num1 - num2)
elif op == "/" :
print(num1 / num2)
elif op == "*" :
print(num1 * num2)
elif op == "**" :
print(num1 ** num2)
else:
print("Invalid operator")
while True:
i = int(input("Press 1 to Continue, otherwise press 0\n"))
if i == 1:
calc()
else:
break