+ 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

27th Sep 2018, 12:51 AM
DrChicken24
DrChicken24 - avatar
2 Réponses
+ 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)
27th Sep 2018, 2:49 AM
Anton G
Anton G - avatar
+ 1
Wow... not paying attention. Thanks much!
27th Sep 2018, 3:05 AM
DrChicken24
DrChicken24 - avatar