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

else: Syntax error

What am doing wrong here? >>> num = 7 >>> if num == 5: print("Number is 5") else: SyntaxError: invalid syntax

23rd Nov 2016, 10:13 AM
Abid Riaz
Abid Riaz - avatar
2 Answers
+ 2
yes it is if (a==b.): codes here true else: codes here false
23rd Nov 2016, 10:30 AM
Sandeep Chatterjee
+ 1
The else doesn't have to be indented I suggest you to use a IDLE instead of an prompt
23rd Nov 2016, 10:22 AM
Wesley Chan
Wesley Chan - avatar