Create a Python program that generates 20 random Names into a list.
import random result = [] alphabets = "abcdefghijklmnopqrstuvwxyz" for i in range(20): # Generating number of characters in the name nameLength = random.randint(3,7) name = "" for j in range(nameLength): name += alphabets[random.randint(0,25)] result.append(name) print("20 random Names list:") print(result)
20 random Names list: ['pouhgct', 'wzqnkaj', 'khpvrsv', 'vnv', 'tncyuhm', 'omx', 'tks', 'hurd', 'bdqh', 'kutt', 'mcfvm', 'odsupi', 'llv', 'qchlop', 'phlri', 'qnqoifj', 'tyq', 'bvpcnc', 'saspgcu', 'xla']
Get Answers For Free
Most questions answered within 1 hours.