You can download this code by clicking the button below.
This code is now available for download.
This function takes a list as an argument and randomly shuffles the order of the elements within the list in place.
Technology Stack : random
Code Type : Function
Code Difficulty : Intermediate
import random
def shuffle_list(items):
"""
Randomly shuffle the elements of the list in place.
Parameters:
items (list): The list to be shuffled.
Returns:
list: The shuffled list (the same list passed in, shuffled in place).
"""
random.shuffle(items)
return items