Shuffle List Function

  • Share this:

Code introduction


This function takes a list as input and returns a shuffled copy of it.


Technology Stack : random.sample

Code Type : Function

Code Difficulty : Intermediate


                
                    
import random

def shuffle_list(input_list):
    """
    This function takes a list as an input and returns a shuffled version of it.
    """
    return random.sample(input_list, len(input_list))

# JSON Explanation