mercredi 14 octobre 2020

Randomly choosing from multiple lists in python

I have 3 lists and want a way that Python chooses multiple options from all lists. How can I do this?

I've tried the code below, but it only gives me 1 option in total.

list_1 = [1,3,5]

list_2 = [2,4,6]

list_3 = [10]

random.choice([random.choice(list_1)] + [random.choice(list_2)] + 
              [random.choice(list_3)])



Aucun commentaire:

Enregistrer un commentaire