Python Invalid Syntax Problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Python Invalid Syntax Problem

I just started python and I have a problem with an else statement syntax

6th May 2022, 7:20 PM
blazer!
blazer! - avatar
7 Answers
+ 2
if, and it's correspoding elif, else should be idented at same level..!!! Look again.. Also if input to chosenNum is number, then convert to needed type, like chosenNum = int( input() )
6th May 2022, 7:34 PM
Jayakrishna 🇮🇳
+ 1
Check the indentation (line 12 and following): it's indented one too many
6th May 2022, 7:25 PM
Lisa
Lisa - avatar
+ 1
6th May 2022, 7:35 PM
blazer!
blazer! - avatar
+ 1
The code on lines 16 to 17 is still indented one too many, and 18 to 19 two too many
6th May 2022, 7:37 PM
Lisa
Lisa - avatar
0
I tried that Lisa
6th May 2022, 7:31 PM
blazer!
blazer! - avatar
0
Rewrite the code and watch the indentation,
8th May 2022, 2:41 PM
bikal rai