Skip to content

Commit b65f34d

Browse files
feat: madlibs story generator
1 parent f491af4 commit b65f34d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
""" This program generates a fun story by asking the user for different types of words"""
2+
3+
def mad_libs_story():
4+
# Ask the user for words
5+
name = input("Enter a name: ")
6+
animal = input("Enter an animal: ")
7+
adjective1 = input("Enter an adjective: ")
8+
adjective2 = input("Enter another adjective: ")
9+
place = input("Enter a place: ")
10+
verb1 = input("Enter a verb (present tense): ")
11+
verb2 = input("Enter another verb (present tense): ")
12+
food = input("Enter a type of food: ")
13+
color = input("Enter a color: ")
14+
15+
# Story template with placeholders
16+
story = f"""
17+
Once upon a time, in the {adjective1} land of {place}, there lived a {adjective2} {animal} named {name}.
18+
Every morning, {name} would {verb1} happily around the {color} fields, dreaming of {food}.
19+
One day, {name} decided to {verb2} beyond the mountains to discover new adventures.
20+
Along the way, {name} met many strange creatures, some friendly and some {adjective1}.
21+
Finally, after a long journey, {name} returned home with amazing stories to share, feeling proud and {adjective2}.
22+
And from that day on, {name} became known as the bravest {animal} in all of {place}.
23+
"""
24+
25+
# Print the story
26+
print(story)
27+
28+
# Run the story generator
29+
if __name__ == "__main__":
30+
mad_libs_story()

0 commit comments

Comments
 (0)