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 235 views
1 answer 244 views
1 answer 255 views
1 answer 273 views
1 answer 269 views
1 answer 255 views
2 answers 327 views
...