+ 1

Calculator

I made a simple calculator and it doesn't work, can someone tell me what's wrong. PS: the code is in my profile, it's called "Simple Calculator V.2".

1st Jun 2018, 6:08 PM
Owen Bowers
1 Réponse
+ 2
you can't use that infinity loop on playground codes. this code might be helpful 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("number: ") if 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
1st Jun 2018, 6:58 PM
Raj Chhatrala
Raj Chhatrala - avatar