+ 1
🤔 Hi! Could you help me? My first Code doesn't work 😓...some indent's error appears!
3 Antworten
+ 2
your line 10-16:
if user_input == "quit":
break
elif user_input == "add":
^here is your problem,your indentation of elif should always be the same as 'if' so just add 2 spaces to all elif
num1 = float(input("Enter a number: "))
num2 = float(input("Enter another number: "))
result = str(num1 + num2)
+ 2
Your next problem is line 34-38:
print("The answer is " + result)
^when you put print function after the elif functions,you have broken the if else statement,so basically the bottom 'else' is out
else:
()
print("Unknown input")
you can consoder something like
if result != None:
print("The answer is " + result)
after the else statement
0
Thx shiny! But It doesn't work yet 🤯