0

Why it doesn't output?

https://code.sololearn.com/cmQ2JrxzSzCB/?re 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: \n")) num2 = float(input("Enter a number: \n")) result = str(num1 + num2) print("The answer is: " + result) elif user_input == "Subtract": num1 = float(input("Enter a number: \n")) num2 = float(input("Enter a number: \n")) result = str(num2 - num1) print("The answer is: " + result) elif user_input == "Multiply": num1 = float(input("Enter a number: \n")) num2 = float(input("Enter a number: \n")) result = str(num1 * nu

22nd May 2020, 10:41 AM
Walid Rabei
2 Answers
+ 7
You have to remove the closing bracket ")" in line 3. Other than that the code works fine. Just remember that in Sololearn you have to provide the whole input beforehand, separated with newlines, so: Add 5 4 Quit
22nd May 2020, 11:15 AM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 1
Last line finish it result =str (num1 *num2) But Do this result=num1*num2 print ( "% d"% result) And do this every where else
22nd May 2020, 11:24 AM
ACID
ACID - avatar