0
I got the IDLE on my windows 8 and am trying to run else if not (1+1==3): and the shell is highlighting else in red and telling me invalid syntax. Is there any thing wrong with the code? Its on learn Python
2 Respostas
+ 2
There are two ways to make an else if expression:
1.
else:
if not x == y:
print (x)
else:
if x == z:
print (x + z)
else:
if ...
2. way (the easier in my opinion) is to use elif instead:
if x == y:
print (x)
elif: x == z:
print(z)
elif: ...
second way is shorter and you get no problems with too much indentation
0
Try using elif