Random Lowercase String Generator

  • Share this:

Code introduction


This function generates a random string of lowercase letters of specified length.


Technology Stack : string, random

Code Type : String generation

Code Difficulty : Intermediate


                
                    
import string
import random

def generate_random_string(length=10):
    return ''.join(random.choices(string.ascii_lowercase, k=length))                
              
Tags: