0

[Python] Why does print(random.shuffle([1,2,3])) return None?

This is not the case on my computer.

19th Mar 2017, 10:25 PM
John Ritchie
John Ritchie - avatar
1 Answer
+ 5
the shuffle method of the random module does return None. to print the shuffled list do: L = [1,2,3] random.shuffle(L) # shuffles list in place and returns None print(L)
19th Mar 2017, 10:33 PM
Ulisses Cruz
Ulisses Cruz - avatar