Randomly Shuffle Words Function

  • Share this:

Code introduction


This function shuffles a list of words randomly.


Technology Stack : random

Code Type : Function

Code Difficulty : Beginner


                
                    
import random

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

# JSON representation                
              
Tags: