lundi 21 septembre 2015

My else statement is always an invalid syntrax

I follow a course "web programming" and I'm stuck in Python. My "else" statement always gives an error (invalid syntax). No matter which code I try (any random code I use from the web), I always get the same error with my else statement. This is a very simple code which gives the error:

#!/usr/bin/python

test1 = 2
test2 = 1

if test1 < test2:
    print("Is smaller")
elif test1 > test2:
    print("is bigger")
else test1 == test2:
    print("is equal")


This is what I get in Terminal:

  File "varvergelijken3.py", line 10
    else test1 == test2:
             ^
SyntaxError: invalid syntax

Aucun commentaire:

Enregistrer un commentaire