Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Question

>>> num=7 >>> if num==5: print(“number is 5”) else: Syntax error: invalid syntax

23rd May 2018, 4:24 PM
Pragya Singh
Pragya Singh - avatar
2 Answers
+ 3
Is there a line after this line? else: If not, remove the else or: else: pass
23rd May 2018, 4:38 PM
Paul
Paul - avatar
+ 1
Just after else it gives a syntax error
23rd May 2018, 4:44 PM
Pragya Singh
Pragya Singh - avatar