From the comments:
The problem is in misunderstanding of how random.shuffle
works. You've tried to iterate through the returned value which is None
, because shuffle
returns nothing and changes its argument in-place.
Here's how you can solve this problem:
lst = [[[]], [1, None], 2, [[], 3], 4]
shuffle(lst) # Don't capture the return value
# lst is now shuffled and you can put it into `for` loop:
for x in lst:
# something