making a calculator ive got + , - , * and / down
but those need 2 inputs
and ive got 4 more options that would only need 1 input and im not sure how to go about it
# Calculator e'-'e
def calculator():
while True:
print("Please select what calculation you'd like to perform:\n")
menu = int(input('''
1.) Add
2.) Subtract
3.) Multiply
4.) Divide
5.) Square
6.) Cube
7.) Square Root
8.) Cube Root
9.) Exit'''))
try:
x = float(input("Please enter your first number:\n"))
y = float(input("Please enter your second number:\n"))
except ValueError as ERROR:
print("Input given was not a number.")
print(ERROR)
return
if menu == 1:
answer = x + y
elif menu == 2:
answer = x - y
elif menu == 3:
answer = x * y
elif menu == 4:
answer = x / y