+ 1
Some problems with a code
while True: print("Options:") print("Enter 'add' to add two numbers") print("Enter 'exit' to end the program") input = input(": ") if input == "quit": break elif user_input == "add": num1=int(input("Num1: ")) num2=int(input("Num2: ")) else: print("Unknown input") Need some help here.
3 Answers
0
In your options, you write "Enter 'exit' to end the program" but in your if statement, the user input that would end the program is "quit", not "exit". You want to make the two consistent.
Also, you would want to turn your user input into a float rather than an integer, otherwise you will only be able to add integers properly and any non-integer inputs will give a ValueError.
Edit: The code you gave doesn't match the one in the playground...