jeudi 15 mars 2018

Creating variable out of random output

So I'm creating a basic (my first project using python) game with python. there is a part where I put a random.choice. I want to refer back to the same random number that it picked so I wondered if it is possible to create a variable for that output. I've tried str = randomint(1,7) but that didnt give me the result I wanted.

# random module
import random
dice1 = ['1','2','3','4','5','6','7']
print (random.choice(dice1))




Aucun commentaire:

Enregistrer un commentaire