Randomly Shuffle Words Function

  • Share this:

Code introduction


This function takes a list of words as an argument and then randomly shuffles the order of the words in the list, returning the shuffled list.


Technology Stack : random

Code Type : Function

Code Difficulty : Intermediate


                
                    
import random

def shuffle_words(words):
    """
    Randomly shuffle a list of words.
    """
    random.shuffle(words)
    return words

# JSON representation of the code                
              
Tags: