You can download this code by clicking the button below.
This code is now available for download.
Defined a function that randomly shuffles the elements of the input list.
Technology Stack : random
Code Type : Function
Code Difficulty : Intermediate
import random
def shuffle_list(input_list):
"""
Randomly shuffles the elements of the input list.
:param input_list: list of elements to be shuffled
:return: a shuffled list
"""
shuffled_list = input_list.copy()
random.shuffle(shuffled_list)
return shuffled_list