Random shuffle?

Hello
Why random shuffle always give None result?

random.shuffle() works in place, as the documentation says. It does not give a return value, therefor a is None. You could write instead:

a = x[:] # make full copy of list, so shuffle doesn't mess with the original list
random.shuffle(a)
2 Likes

Thank you it work

2 Likes