+ 3
Python Calculator Help
So I am going through the Python course, and I got to the calculator lesson. I made a few small changes to make it a bit more personalized, but it is saying elif is invalid syntax... can someone help? Link: https://code.sololearn.com/c2Y77kVCubRG/#py
2 Answers
+ 2
Hi DrChicken24 ,
You need to align all result/print lines, that are inside elif block, i.e:
elif user_input == "-":
num3 = float(input("Enter a number: "))
num4 = float(input("Enter another number: "))
result2 = str(num3 - num4)
print("The result is: " + result2)
instead of
elif user_input == "-":
num3 = float(input("Enter a number: "))
num4 = float(input("Enter another number: "))
result2 = str(num3 - num4)
print("The result is: " + result2)
+ 1
Wow... not paying attention. Thanks much!