one-file-projects/namegenerator.py
2014-08-31 06:14:41 +02:00

19 lines
473 B
Python

import random as pseudorandom
consonants = ['b','c','d','f','g','h','k','l','m','n','p','r','s','t','v','w','x','z']
vocals = ['a','e','i','o','u','y']
both = [consonants,vocals]
def generate_name(length=3):
gid = pseudorandom.randint(0,1)
name = ""
for i in range(length):
ch = pseudorandom.choice(both[gid])
name += ch
gid = (gid + 111) % 2
return name
for i in range(10):
print(generate_name(pseudorandom.randint(3,10)))