mad lib
A word game where a story has blanks for nouns, verbs and so on, filled from a player's answers without seeing the story.
In more detail
The course's first sample program is a mad lib: it asks for words, then prints the story with them substituted in. The same program returns several times, rebuilt with dictionaries, format strings, loops and finally a web page.
Related terms
- format method — The string method that returns a copy of a string with each {} replacement field filled in from its arguments.
- dictionary — A Python collection that stores values under keys, written in curly brackets, such as {"tea": 250}.
- input() — The built-in function that shows a prompt, waits for the user to type a line and press Enter, and returns what they typed as a string.
Taught in
- Your Python Folder And A First Program — Hands-on Python: Complete Video Course & Book
- A Sample Program, Explained — Hands-on Python: Complete Video Course & Book
- The Idle Editor And Running Programs — Hands-on Python: Complete Video Course & Book
- Dictionaries And String Formatting — Hands-on Python: Complete Video Course & Book
- Mad Libs Revisited: The Whole Program — Hands-on Python: Complete Video Course & Book