-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhile_calculator.py
More file actions
42 lines (35 loc) · 1.08 KB
/
Copy pathwhile_calculator.py
File metadata and controls
42 lines (35 loc) · 1.08 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
33
34
35
36
37
38
39
40
41
42
on = True
def add():
print("-----Addition-----")
a = float(input("Enter the first number : "))
b = float(input("Enter the second number : "))
print(a+b)
def subtraction():
print("----- subtraction -----")
a = float(input("Enter the first number: "))
b = float(input("Enter the second number : "))
print(a - b)
def multiplication():
print("-----multiplication-----")
a = float(input("Enter the first number : "))
b = float(input("Enter the second number : "))
print(a * b)
def division():
print("-----Division-----")
a = float(input("Enter the first number : "))
b = float(input("Enter the second number : "))
print(a / b)
while on:
operation = input("Please selct the type + , - , * , / ,or q")
if operation == "+":
add()
elif operation == "-":
subtraction()
elif operation == "*":
multiplication()
elif operation == "/":
division()
elif operation == 'q':
on == False
else:
print("The operation is not available")