Create silly stories with code!
Use everything you learned โ variables, strings, and print โ to build a Mad Libs story generator!
Time to build your first real project! A Mad Libs generator asks for words (like a noun, an adjective, and a verb), then plugs them into a story to create something hilarious. You will use variables to store the words and string concatenation to build the story.
๐ก Think of it like this:
Mad Libs is like a fill-in-the-blanks party game. You ask friends for random words without telling them the story. Then you read the story with their words plugged in โ and everyone laughs!
This project combines everything you have learned so far: print, variables, strings, and input. It proves you can build something fun and real with just a few lines of code!
Where you see this in real life:
Mad Libs was invented in 1953 and has sold over 150 million copies. Now you are building your own digital version!
Time for your first real project! A Mad Libs generator asks for words (a noun, an adjective, a verb) and plugs them into a story to create something hilarious.
You will use input()to get words from the user, store them in variables, and join them into a story with +.
input()asks the user a question and waits for them to type an answer. Whatever they type gets stored as a string!
Type your answer in the output area when prompted!First, we ask the player for a bunch of words. We store each one in a variable.
Click โถ Run to see the output!Now we plug the words into a story template using string concatenation (+).
Click โถ Run to see the output!Now try writing your OWN Mad Libs story! Here are some ideas:
Click โถ Run to see the output!What does the input() function do?