mercredi 8 février 2017

How to add exception to random.randint in Python?

So I have a variable that creates a random number between 0 and 10, however, I would not like the random number created to be 5. How do I go about adding exceptions to random.randint in Python? What I have below is not doing this:

number = random.randint(0, 10) !=5

This is only returning True or False based on whether the random number equals 5 or not... how do I fix this?




Aucun commentaire:

Enregistrer un commentaire