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

Else and elif statements

Every time I use the else: and elif: statements my code doesn’t run and it shows me an error stating ‘invalid syntax’. Why is it so?

21st Mar 2018, 7:29 AM
Goku
2 Answers
+ 3
Seeing the code helps, but you might be leaving it incomplete, like: if 1 == 2: print(“universe broke”) else: The code above has syntax error indeed, try writing: # ... else: pass
21st Mar 2018, 3:20 PM
Pedro Demingos
Pedro Demingos - avatar
+ 4
please, post your code here
21st Mar 2018, 8:34 AM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar