What did I wrong with this self made Calculator? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What did I wrong with this self made Calculator?

So, I`m a beginner with programming, so I don`t really understand much about this and don`t know what I exactly did wrong... 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": ... elif user_input == "subtract": ... elif user_input == "multiply": ... elif user_input == "divide": ... else: print("Unknown input") elif user_input == "add": num1 = float(input("Enter a number: 3")) num2 = float(input("Enter another number: 4")) elif user_input == "add": num1 = float(input("Enter a number: 3")) num2 = float(input("Enter another number: 4")) result = str(num1 + num2) print("The answer is " + result) So, can anyone help me?

8th Feb 2019, 10:50 PM
Dogast Dogendorf
Dogast Dogendorf - avatar
1 Answer
0
Ill take a look. Just a second :) Edit: Well, first, for each input you just put three dots like this : ... That won't do anything as it isn't code. You also have some invalid indents. Did you copy and paste this directly from the python course? If so, it wont work. You will have to continue on in the courses to learn the code to put.
9th Feb 2019, 1:27 AM
DrChicken24
DrChicken24 - avatar