Mad Libs is a classic beginning exercise for students learning programming.

Key Pieces

  • comments
  • console input
  • variable assignment
  • following variable naming conventions
  • string formatting
  • console output

Python Example

# Simple Mad Libs example

# Prompt and store words
noun = input("noun: ")

# Add the words to the Mad Lib template
s = f"""
Hello {noun}!
"""

# Output the complete Mad Lib
print(s)