Shuffle List Functionality

  • Share this:

Code introduction


This function takes a list as input and uses the shuffle method from the random library to randomly rearrange the elements of the list.


Technology Stack : random

Code Type : Function

Code Difficulty : Intermediate


                
                    
import random

def shuffle_list(input_list):
    """
    Shuffle the elements of the input list.
    """
    random.shuffle(input_list)
    return input_list                
              
Tags: