0
num = 7 if num == 5: print('Number is 5') elif num == 11: invalid syntax
it appears that my elif statement has an indent problem but my IDLE tells me syntax. suggestions?
5 Respuestas
+ 1
I found that it was an indenting issue.
0
Any time you are using an if/else statement, the following line must be indented.
if x == 3:
print('correct')
elif x == 5:
print('also correct')
else:
print('still correct')
0
not only for elif even for if u have a indent issue. and be careful with statements after elif , as even absence of statements brings out error.
0
that is what i found. thank you for your input.
0
after you write what you wanna print. it doesn't start a new line, so u have to press left arrow to start from the beginning of the line.
if num == 5:
print("number is 5")
else: <-------beginning of a new line