random.shuffle() - Shuffles the elements of a given list in place

PHOTO EMBED

Tue Jun 18 2024 03:06:00 GMT+0000 (Coordinated Universal Time)

Saved by @pynerds #python

#import the random module
import random

#The list to shuffle
my_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

#shuffle the list in-place
random.shuffle(my_list)

print(my_list)
content_copyCOPY

https://www.pynerds.com/python-random-shuffle-function/