I have a list of 10 letters and I want to generate 100 random rows of 5 characters using these letters. Here, I could form one random list; however I need to form 100 random lists.
import random  
import string  
def random_list(length):  
    letters = 'pqrstuvwxy'     
    result = ''.join((random.choice(letters)) for x in range(length))  
    print("List1\n",result)   
    
random_list(5)
The output of the above code is:
List1
 wyquq
What I want to do is to generate a .txt file in this format:
List1
wyquq
List2
qrrxw
List3
ysrvs
...