mercredi 6 avril 2016

How to simplify multiple or conditions in an if statement?

So I wanted to write this:

if x % 2 == 0 or x % 3 == 0 or x % 5 == 0 or x % 7 == 0:

But this way:

if x % (2 or 3 or 5 or 7) == 0:

How should I write it in a proper way?

Aucun commentaire:

Enregistrer un commentaire