Warum gibt es einen Fehler, wenn ich die Kapitalisierungsfunktion verwende?
Posted: 01 Mar 2025, 15:02
Warum gibt es "AttributeError: 'List' -Objekt aus, das kein Attribut 'Kapitalisierung'" "
auf surt
auf surt
Code: Select all
names = [] # List to store generated names
consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"]
vowels = ["a", "e", "e", "i", "o", "u"]
for _ in range(amount):
name = "" # Initialize an empty string for each name
for _ in range(name_length + random.randint(round((name_length - ((name_length * 2) - 1)) / 2), round((name_length - 1) / 2))):
consonant = random.choice(consonants)
vowel = random.choice(vowels)
name += consonant + vowel # Append consonant and vowel to the name
names.append(name) # Add the generated name to the list
sentence = names.capitalize()
print(" ".join(sentence), end=".") # Print all generated names, joined by a comma```