I have a code:
import random
vowels, consonants='aeiou','bcdfghjklmnpqrstvwxyz'
terms = int(input("How many letters you want for your baby's name? "))
def babyname():
j=[]
for i in range(0, terms):
k = input("Would you like a [v]owel or [c]onsonant: ")
if k.lower() == 'v':
j.append(random.choice(vowels))
elif k.lower() == 'c':
j.append(random.choice(consonants))
else:
print("Unknown Input: "+ k)
for x in range(0, 10):
print(''.join(j))
babyname()
Input: I can input a number say 5 for the number of letters and v or c for those number of letters.
Expected output: For the input, I want to generate the generated text j for 10 times each one with different texts. For the example input, the expected output should be - sdfes gdadf nkadj like this 10 words.
Output yielded: Instead of getting 10 different texts, I am getting an output like sdfes sdfes sdfes - the same text for 10 times.
How to solve this?