-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator_Using_Conditionals.py
More file actions
42 lines (26 loc) · 1.13 KB
/
Copy pathCalculator_Using_Conditionals.py
File metadata and controls
42 lines (26 loc) · 1.13 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
import time
question = input("What operation do you want to use \n1. Addition + \n2. Subtraction - \n3. Multiplication x \n4. Division / \n5. Quotient // \n6. Remainder \n Choose any : ")
print(question, type(question))
time.sleep(2)
num1 = int(input("enter first Number : " ))
num2 = int(input("enter second Number : "))
if question == "1":
total = num1 + num2
print("The sum of {} and {} is {}".format(num1, num2, total))
elif question == "2":
difference = num1 - num2
print("The difference of {} and {} is {}".format(num1, num2, difference))
elif question == "3":
product = num1 * num2
print("The product of {} and {} is {} ".format(num1,num2, product))
elif question == "4":
division = num1 / num2
print("The division of {} and {} is {} ".format(num1,num2 , division))
elif question == "5":
quotient = num1 // num2
print("The quotient of {} and {} is {}".format(num1, num2, quotient))
elif question == "6":
remainder = num1 % num2
print("The remainder of {} and {} is {}".format(num1, num2, remainder))
else:
print("Invalid input")