In-place List Shuffling Function

  • Share this:

Code introduction


This function accepts a list as an argument and shuffles the elements of the list in place.


Technology Stack : random

Code Type : List scrambled

Code Difficulty : Beginner


                
                    
import random

def shuffle_list(input_list):
    """
    Shuffle the elements of the list in-place.
    """
    random.shuffle(input_list)

    return input_list                
              
Tags: