dimanche 4 juin 2017

Python List random choice

Looking for a help / solution here.

a = [1,2,3]
b = [1,2,3]
c = [1,2,3]
d = [a,b,c]

random.choice(random.choice(d))

this gives me 1,2 or 3. But how to find which list variable this random function used out of a, b, c ? how can I use or what is the syntax of the index function for this ? for my program I have to pop the element the random choice returns.




Aucun commentaire:

Enregistrer un commentaire