samedi 14 novembre 2020

Why is Shuffle Returning None

I'm using the random module for a program and don't want items from the list to repeat, so I'm using shuffle. The problem is when I run it, it returns None instead of the items in the list.

from random import shuffle

list = ["a", "b", "c", "d"]

new_list = []

for l in list:
   n = shuffle(list)
   new_list.append(n)
print(new_list)



Aucun commentaire:

Enregistrer un commentaire