mercredi 13 juin 2018

Python: Random Number except numbers written in list before

I am pretty much a beginner and am trying to make a cardgame work. Until now everything worked just fine, but now I have a problem and hoped I could ask you for advice.

I know how to get random Numbers from for Example 7 to 14, but is it also possible to somehow get random Numbers from 7 to 14 except some Numbers from a List written before?

Example:

Forbidden = [12, 13, 8, 7]

a = randint(7, 14)

//a Should be a Random number but not the numbers written in "Forbidden" before

Thank you for every answer!




Aucun commentaire:

Enregistrer un commentaire