vendredi 10 août 2018

elif statement indentation syntax error with Python IDLE v3.5 on Windows

Why the elif always failed with syntax error here? I used Python IDLE 3.7.0 for windows 64bits. enter image description here

It works well with baisc strings, numbers, and lists. But when I tried if - elif statements in 3 ways, all failed with syntax error. Could anybody help?

The code I used was from the python documents chapter 4.1 if statements as shown below. enter image description here

  1. Copy and paste the original from the python documents. But if failed with syntaxerror: unindent does not match any outer indentation level. enter image description here

  2. Write print statement in the same line as elif, but it still failed with syntax error: enter image description here

  3. Indent the elif with the same place as if. Still failed. enter image description here

Aucun commentaire:

Enregistrer un commentaire