Shuffle List Function

  • Share this:

Code introduction


This function is used to shuffle the elements of a list


Technology Stack : random

Code Type : Function

Code Difficulty : Beginner


                
                    
import random

def shuffle_list(items):
    if not isinstance(items, list):
        raise TypeError("items must be a list")
    random.shuffle(items)
    return items                
              
Tags: