small medium large xlarge

24 Mar 2014, 18:57
Saad Bashir (1 post)

1.On page 90 and 91 while discussing if and elif statements, when I type elif in the python shell, it says ‘invalid syntax’ and highlights “elif.”

I am using the 3.2.3 version of Python.

Can anyone help please?

25 Mar 2014, 16:52
Jason Montojo (8 posts)

Hi Saad,

Can you paste exactly what you’re typing into the shell to get the ‘invalid syntax’ error? ‘elif’ needs to be used in conjunction with ‘if’ so if you’re missing the ‘if’, that’s one reason why you’re getting the error. Or if you terminate the ‘if’ block too early by adding a blank line after the ‘if’ block.

Hope this helps, Jason

You must be logged in to comment