mercredi 6 janvier 2016

Python: How to test for a range of inconsistent values

I need to test in python if x equals a series on inconsistent numbers for example 1, 2, 7, 9, 32, 98

Is their something I can use that wouldn't take forever? I know I could type

if x == 1 or x== 2 or x ==7 or x== 9 ...:
    [code here]

is there a quicker way to type this in the python syntax?

Aucun commentaire:

Enregistrer un commentaire