Your friend is writing a fantasy novel set in the mythical land of Aetheria, but they're struggling to create character names. Help them by building a name generator!
Below, you'll find:
first_names
suitable for Aetherian characterslast_names
suitable for Aetherian charactersrandint
function to help you select random namesWrite a function random_name()
that returns a randomly generated full name.
Example:
print(random_name())
# Output: "Thranduil Starfire"
Write a function random_party(party_size)
that generates multiple unique character names and returns them as a grammatically correct string.
Examples:
print(random_party(1))
# Output: "Thranduil Brightblade"
print(random_party(2))
# Output: "Gandalf Ironfist and Celeborn Starfire"
print(random_party(3))
# Output: "Thranduil Brightblade, Gandalf Ironfist, and Celeborn Starfire"
Requirements:
randint
¶randint(a, b) # Returns random integer from a to b (inclusive)
# Example: randint(0, 9) could return any number from 0 to 9
result = ""
for i in range(3):
result += str(i)
print(result) # "012"
Remember: if a list has 10 items, valid indices are 0-9!
from random import randint
first_names = [
"Arwen",
"Elrond",
"Galadriel",
"Legolas",
"Thranduil",
"Eowyn",
"Boromir",
"Faramir",
"Gandalf",
"Celeborn",
]
last_names = [
"Stormrider",
"Shadowhunter",
"Moonwhisper",
"Nightshade",
"Dragonbane",
"Ironfist",
"Brightblade",
"Windwalker",
"Starfire",
"the Bard",
]
def random_name():
# Add your code here
pass
def random_party(party_size):
# Add your code here
pass
# Example Usage
print(f"{random_name()} entered the tavern where they met {random_name()} the tavern keep")
print(f"{random_party(3)} approached the evil {random_name()}")
Eowyn Nightshade, Thranduil Brightblade, and Galadriel Windwalker