How to generate 10 random 5 characters strings in Python

1 Answer

0 votes
import random
import string
 
for i in range(10): 
    s = ""
    for j in range(5):
        s += random.choice(string.ascii_letters)
    print(s)

 
 
 
'''
run:
 
lsztX
rhssD
HmLgy
ixMaP
CFJWu
gMunh
Ihwrf
rTpKC
RZYVW
BhRdn
 
'''

 



answered Sep 29, 2021 by avibootz

Related questions

1 answer 144 views
1 answer 157 views
1 answer 163 views
1 answer 185 views
1 answer 168 views
1 answer 157 views
2 answers 175 views
...