+ 3

Python EOF Error

In the code, when you try to run it and type in a word, it gives out EOF Error...can somebody help me???? while True: print("Options:") print("Enter 'add' to add two numbers") print("Enter 'subtract' to subtract two numbers") print("Enter 'multiply' to multiply two numbers") print("Enter 'divide' to divide two numbers") print("Enter 'quit' to end the program") user_input = input(": ") if user_input == "quit": break elif user_input == "add": num1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ")) result = str(num1 + num2) print("The answer is " + result) elif user_input == "subtract": num1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ")) result = str(num1 - num2) print("The answer is " + result) elif user_input == "multiply": num1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ")) result = str(num1 * num2) print("The answer is " + result) elif user_input == "divide": num1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ")) result = str(num1 + num2) print("The answer is " + result) else: print("Unknown input") Can you please help me?

7th Jan 2020, 7:54 PM
Edu Ramos
Edu Ramos - avatar
3 Respostas
+ 4
Run this code to understand how input works in SoloLearn https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
7th Jan 2020, 10:21 PM
Ipang
+ 5
Thanks
27th Jan 2020, 2:13 PM
Edu Ramos
Edu Ramos - avatar
0
sololearn doesnt allow interactive input. hope this helps Edu Ramos
5th Jul 2020, 4:37 PM
Aqualine27
Aqualine27 - avatar