else: Inavlid Syntax! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

else: Inavlid Syntax!

getting error while using else statement :- z=7 if z==8: print("yes") else: SyntaxError: invalid syntax

13th Mar 2017, 12:16 PM
Smile garg
Smile garg - avatar
3 Answers
+ 2
remove the tab before else.
13th Mar 2017, 12:17 PM
Nithin
Nithin - avatar
+ 2
Align if and else in the same 'invisible' line (called as indentation).
13th Mar 2017, 12:27 PM
Meharban Singh
Meharban Singh - avatar
0
got it! thanks!
13th Mar 2017, 2:06 PM
Smile garg
Smile garg - avatar