0
Can anyone explain why the following code is not working? i am trying to make a calculator
the following code keeps giving an error: print("Python Calculator") while True: num1 = int(input("please enter first number: ")) opera = input("please enter operation(+, -, *, /): ") num2 = int(input("please enter second number: ") if opera == "+" print("your total = " + str(num1 + num2)) print("-"*20) elif opera == "-" print("your total = " + str(num1 - num2)) print("-"*20) else print("syntax error")
2 Antworten
+ 2
You forgot the colon : after the if,elif and else statements.
if opera=='+':
print (..
0
yes but that gave an error as well, so when i did it without the colon it got an error at the print section