0

what is wrong in this code code playground = my calculator unfinished python the error is EOF

while True: print("Options:") printnd the program") user_input = input("shariq") 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)("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 e print("The answer is " + result) else: print("Unknown input")

13th Feb 2020, 4:05 PM
Coder
Coder - avatar
2 Antworten
+ 2
We need more info, what was the error code exactly? Also, write it in code playground, and share the code here, for better readability.
13th Feb 2020, 4:09 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
Well.... actually u r concatenate string with result (which is either in integer, float) ...that's why interpreter gives u error...u have to revise basics
13th Feb 2020, 4:19 PM
Soma Mishra
Soma Mishra - avatar