-
Notifications
You must be signed in to change notification settings - Fork 0
/
day010.py
57 lines (56 loc) · 2.12 KB
/
day010.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
logo = """
_____________________
| _________________ |
| | Pythonista 0. | | .----------------. .----------------. .----------------. .----------------.
| |_________________| | | .--------------. || .--------------. || .--------------. || .--------------. |
| ___ ___ ___ ___ | | | ______ | || | __ | || | _____ | || | ______ | |
| | 7 | 8 | 9 | | + | | | | .' ___ | | || | / \ | || | |_ _| | || | .' ___ | | |
| |___|___|___| |___| | | | / .' \_| | || | / /\ \ | || | | | | || | / .' \_| | |
| | 4 | 5 | 6 | | - | | | | | | | || | / ____ \ | || | | | _ | || | | | | |
| |___|___|___| |___| | | | \ `.___.'\ | || | _/ / \ \_ | || | _| |__/ | | || | \ `.___.'\ | |
| | 1 | 2 | 3 | | x | | | | `._____.' | || ||____| |____|| || | |________| | || | `._____.' | |
| |___|___|___| |___| | | | | || | | || | | || | | |
| | . | 0 | = | | / | | | '--------------' || '--------------' || '--------------' || '--------------' |
| |___|___|___| |___| | '----------------' '----------------' '----------------' '----------------'
|_____________________|
"""
play=True
print(logo)
def add(n1,n2):
return int(n1+n2)
def sub(n1,n2):
return n1-n2
def mul(n1,n2):
return n1*n2
def div(n1,n2):
return n1/n2
def re():
global decision,n1,n2,answer
for i in opdict:
print(i)
choice=input("Enter your choice: ")
op=opdict[choice]
answer=op(n1,n2)
print(f'{n1} {choice} {n2} = {answer}')
decision=input("would you like to use this answer (yes) or perform new calculation (new) \n to quit enter anything")
opdict={
"+":add,
"-":sub,
"*":mul,
"/":div
}
n1=float(input("Enter first number: "))
n2=float(input("Enter Second number: "))
re()
while play:
if decision=="yes":
n1=answer
n2=float(input("Enter Second number: "))
re()
elif decision=="new":
n1=float(input("Enter first number: "))
n2=float(input("Enter Second number: "))
re()
else:
print("GOODBYE")
play=False