+ 3
Why else statement not working in python IDLE??
5 Answers
+ 9
You need almost to unindent the 'else' statement ( he must be aligned with the corresponding 'if' statement ^^ ( look at @Abdul Ghaffar code answer )
So by this way, IDLE would let you type and indent the next line(s) before executing your conditional instructions...
+ 16
Post your code so we can help u out
coz, else statement perfectly works in mine
+ 15
You have to pass an argument for the else statement also, eg
num =7
if num ==5:
print('number is 5')
else:
print('Number is' + num)
+ 2
num=7
if num ==5:
print('number is 5 ')
else:
SyntaxError : invalid syntax
+ 2
thanks visph it helps me a lot