-
Notifications
You must be signed in to change notification settings - Fork 2
/
CalcPRO+.py
78 lines (74 loc) · 2.63 KB
/
CalcPRO+.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
resultadd = float(0)
resultmult = float(0)
resultsub = float(0)
resultdiv = float(0)
numadd = float(0)
numadd1 = float(0)
numadd2 = float(0)
numsub = float(0)
numsub1 = float(0)
numsub2 = float(0)
nummult = float(1)
nummult1 = float(1)
nummult2 = float(1)
numdiv = float(0)
numdiv1 = float(0)
neednotheradd = ()
neednothersub = ()
neednothermult = ()
print("""
Welcome to the PRO version of Calculator+!
This calculator\nhas the ability to add, subtract, multiply,\ndivide.
Your shortcuts are\nadd\nsubtract\nmultiply\ndivide.
""")
typeofcalc = input("What mode do you want?\nNote: Use the shortcuts above.")
print("You want " + typeofcalc + ". Restart the program to pick another shortcut.")
if typeofcalc == "add":
numadd = float(input("Enter your number: "))
numadd1 = float(input("Enter your second addend: "))
neednotheradd = input("Do you need another number? Pick yes or no:")
if neednotheradd == "yes":
numadd2 = float(input("Enter your third addend:"))
elif neednotheradd == "no":
print()
else:
print("You have entered the wrong syntax.")
print("Restart the program to try again.")
resultadd = numadd + numadd1 + numadd2
print(resultadd)
elif typeofcalc == "subtract":
numsub = float(input("Enter your number: "))
numsub1 = float(input("Enter your second number: "))
neednothersub = input("Do you need another number? Pick yes or no:")
if neednothersub == "yes":
numsub2 = float(input("Enter your third number:"))
elif neednothersub == "no":
print()
else:
print("You have entered the wrong syntax.")
print("Restart the program to try again.")
resultsub = numsub - numsub1 - numsub2
print(resultsub)
elif typeofcalc == "multiply":
nummult = float(input("Enter your number: "))
nummult1 = float(input("Enter your second number: "))
neednothermult = input("Do you need another number? Pick yes or no:")
if neednothermult == "yes":
nummult2 = float(input("Enter your third number:"))
elif neednothermult == "no":
print()
else:
print("You have entered the wrong syntax.")
print("Restart the program to try again.")
resultmult = nummult * nummult1 * nummult2
print(resultmult)
elif typeofcalc == "divide":
print("Remember dividing does not support more than two numbers in this calculator.")
numdiv = float(input("Enter your number: "))
numdiv1 = float(input("Enter your second number: "))
resultdiv = numdiv / numdiv1
print(resultdiv)
else:
print("You have entered the wrong syntax.")
print("Restart the program to try again.")
exit()