vendredi 2 octobre 2015

Python: Invalid Syntax in my Else statement

I am starting out with Python and I just cannot figure out what I am doing wrong. This is an easy question for you to get a correct answer for!

Here is my code:

def statement(x):
    if x > 50:
        print("X is greater than 50")
    elif x < 50:
        print("X is lower than 50")
    else x == 50:
        print("X is 50")
    return

Very simple I know. When I try and run this, it returns an error saying invalid syntax regarding the X in my else statement: Screenshot from Python

Could anybody please point me in the correct direction as to what I am doing wrong?

Aucun commentaire:

Enregistrer un commentaire