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

23rd Oct 2016, 2:53 PM
Edidiong Udoh
Edidiong Udoh - avatar
2 Réponses
+ 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
23rd Oct 2016, 3:09 PM
Amarie
0
Try using elif
15th Nov 2016, 12:32 AM
Miles Bradley