dimanche 4 septembre 2022

make a nested list using a for loop and random numbers

I am looking to make a nested list. In each list I will have random numbers generated from 1 - 80 and 1000 lists. I have the random number part down, but can not make the nested list. this is what I have.

def lots_of_draws ():
    numbers_to_draw_from = list(range(1, 81))
    random_draws = sorted(random.sample(numbers_to_draw_from, k=20,))
    random_draws_list = []
    time_ = 0
    while time_ > 100:
        random_draws_list.append(random_draws)
        time_+=1
        print(time_)

    print(random_draws_list)
lots_of_draws()

expected [[1,2,3,4,5,6,7,8,9,11,12,13,20,50,45,58,32,78,80,16],[another 20],[anoter 20],and so on for 100, or 1000]

I don't know what I doing wrong, any help would be great. Thanks




Aucun commentaire:

Enregistrer un commentaire