Sep-27-2018, 01:28 AM
I need help with this calculator code
print("Basic Python Calculator\n") print("Created With the Sololearn Python Course\n") while True: print("Options:") print("Enter '+' to add two numbers") print("Enter '-' to subtract two numbers") print("Enter '*' to add multiply numbers") print("Enter '/' to divide two numbers") print("Enter 'quit' to end the program") user_input = input(": ") if user_input == "quit": break elif user_input == "+": num1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ")) result1 = str(num1 + num2) print("The result is: " + result1) elif user_input == "-": num3 = float(input("Enter a number: ")) num4 = float(input("Enter another number: ")) result2 = str(num3 - num4) print("The result is: " + result2) elif user_input == "*": num5 = float(input("Enter a number: ")) num6 = float(input("Enter another number: ")) result3 = str(num5 * num6) print("The result is: " + result3) elif user_input == "/": num7 = float(input("Enter a number: ")) num8 = float(input("Enter another number: ")) result4 = str(num7 / num8) print("The result is: " + result4) else: print("ERROR: Unknown Input")