Define your words as a nested dictionary structure.
words = {
'movies': [
'Thor',
'Tangled',
'Frozen',
'Spider-Man: No Way Home'
],
'animals': [
'Zebra',
'Porcupine'
],
'characters': [
'Mickey Mouse',
'Loki Odinson'
]
}
Then write your code to first choose a random category, then a word from that category.
def get_word():
type_of_word = random.choice(list(words.keys()))
word = random.choice(words[type_of_word])
return word
print(get_word())