Why am I getting an error?
I’m trying to make a simple calculator. In the last line, I get an error saying “result” is not defined. How do I fix this? while True: print("type 'add' to add two numbers") print("type 'subtract' to subtract two numbers") print("type 'divide' to divide two numbers") print("type 'multiply' to multiply two numbers") print("type 'quit' to end program") user_input=input("operation:") print(user_input) if user_input==("quit"): break num1=float(input("number 1:")) print(num1) num2=float(input("number 2:")) print(num2) if input==("add"): result=str(num1+num2) elif input==("subtract"): result=str(num1-num2) elif input==("multiply"): result=str(num1*num2) elif input==("divide"): result=str(num1/num2) print("answer:"+result)