Random Word Generator

  • Share this:

Code introduction


Generate a random word of a specified length composed of lowercase letters.


Technology Stack : string, random

Code Type : Function

Code Difficulty : Intermediate


                
                    
import string
import math
import random
import re

def random_word(length):
    letters = string.ascii_lowercase
    return ''.join(random.choice(letters) for i in range(length))                
              
Tags: