forked from jessopj1-zz/Python-calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
29 lines (26 loc) · 958 Bytes
/
main.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
print("This is John's awsome (basic) calculator here are a few ground rules:")
print("1. Only use two numbers")
print("2. No fractions")
numb = input("What is your first number?") #ask for the users input
print("1 = Add")
print("2 = Subtract")
print("3 = Divide")
print("4 = Times")
print("5 = Square")
print("6 = Cube")
operator = input("What operator would you like to use?") #life=42
if operator == "5":
print(numb," squared is", int(numb)*int(numb))
elif operator == "6":
print (numb, " cubed is", int(numb)*int(numb)*int(numb))
else:
numb2 = input("What is your second number?")
if operator == "4":
print(numb,"*",numb2,"=", int(numb)*int(numb2))
elif operator == "3":
print(numb,"/",numb2,"=", int(numb)/int(numb2))
elif operator == "1":
print(numb,"+",numb2,"=", int(numb)+int(numb2))
elif operator == "2":
print(numb,"-",numb2,"=", int(numb)-int(numb2))
os.system("pause")