You can download this code by clicking the button below.
This code is now available for download.
This function generates a random string of specified length, consisting of lowercase letters.
Technology Stack : random
Code Type : Generate random strings
Code Difficulty : Beginner
import random
def generate_random_string(length, letters='abcdefghijklmnopqrstuvwxyz'):
return ''.join(random.choice(letters) for i in range(length))