vendredi 8 octobre 2021

How to generate random number into an empty list multiple time

Lets say I want to find all the numbers a fair die can roll sample_size of times.

I first create a empty list

die_list= []
def die_number(sample_size):
    for i in range(sample_size) #i want to iterate what ever the sample_size is
    die_list.append(random.randint(0,7))

is this thought process correct?




Aucun commentaire:

Enregistrer un commentaire