-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeme-calc-V2.py
68 lines (55 loc) · 1.47 KB
/
Meme-calc-V2.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
def mainMenu():
main=input("1.Enter the app\n2.Quit")
if main == "1":
getInputs()
elif main == "2":
print("")
else:
print("Invalid Input")
mainMenu()
def getInputs():
global operation
global firstNumber
global secondNumber
operation=input("Select operation \n 1. + Add \n2. - subtract \n3. / divide \n4. * muliply")
firstNumber=input("First Number")
secondNumber=input("Second Number")
errorHandling()
checkOperation()
def errorHandling():
try:
float(firstNumber)
float(secondNumber)
except:
print("Invalid Input")
getInputs()
def checkOperation():
if operation == "1" and float(firstNumber) == 9.0 and float(secondNumber) == 10.0:
ninePlusTen()
mainMenu()
elif operation == "1":
add()
mainMenu()
elif operation == "2":
subtract()
mainMenu()
elif operation == "3":
divide()
mainMenu()
elif operation == "4":
multiply()
mainMenu()
else:
print("Invalid Input")
getInputs()
def add():
print(float(firstNumber)+float(secondNumber))
def ninePlusTen():
print(float(firstNumber)+float(secondNumber)+2)
def subtract():
print(float(firstNumber)-float(secondNumber))
def divide():
print(float(firstNumber)/float(secondNumber))
def multiply():
print(float(firstNumber)/float(secondNumber))
mainMenu()