Loading…

In Python, How you can randomize the items of a list in place ?

from random import shuffle

x = ['My', 'Singh', 'Hello', 'India']

shuffle(x)

print(x)

The output of the following code is as below.

['Singh', 'India', 'Hello', 'My']

Suggest An Answer

No suggestions avaliable!

Latest post from Python Interview Questions

Ask Question