lundi 24 mai 2021

python if with multiple potential values to check [duplicate]

I am trying to write an if statement that checks multiple values without writing out a bunch of full statements.

Is it possible to get something like this to work:

a = 7
if a == (30 or 7):
    print(1)

Instead of:

a = 7
if (a == 30) or (a == 7):
    print(1)

Aucun commentaire:

Enregistrer un commentaire