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 returns a list with its elements shuffled.
Technology Stack : random
Code Type : Function
Code Difficulty : Beginner
import random
def shuffle_list(input_list):
"""
随机打乱列表中的元素顺序。
:param input_list: 要打乱顺序的列表。
:return: 打乱顺序后的列表。
"""
shuffled_list = input_list.copy()
random.shuffle(shuffled_list)
return shuffled_list
# JSON表示