lundi 23 avril 2018

Python IF-Statement x+y == number [on hold]

I have a short question to my little Python-Code especially to the IF-Statement. I want to do something like this:

def functioName(x, y, size):
    if (x==y):
        return 'RED'
    elif (x-y == 50):
        return 'RED'
    else:
        return 'YELLOW'

Why can I not do x-y == 50. I tried to calculate this outside of the statement like z=x-y and only checked in the statement if z==50 but it didn't work.

Aucun commentaire:

Enregistrer un commentaire