Skip to content

Instantly share code, notes, and snippets.

@vedgar
Created January 6, 2016 15:43
Show Gist options
  • Save vedgar/73fc2aac619ac1201eb8 to your computer and use it in GitHub Desktop.
Save vedgar/73fc2aac619ac1201eb8 to your computer and use it in GitHub Desktop.
youtu.be/qsMfF0d5L20 in a sane programming language
print("Welcome to the MadLibs game. If you type in words, we'll give you a story.")
name = input("Start by typing in a name: ")
noun1 = input("Give me a noun: ")
adjective1 = input("I need an adjective: ")
adjective2 = input("I really need an alpaca... just kidding, give me another adjective: ")
noun2 = input("Give me another noun: ")
adverb = input("PLEASE! I really want an adverb: ")
noun3 = input("Give me the last noun: ")
import random
num = random.randrange(100)
numberHolder = [num, num+1, num+2]
randomnums = "not {0}, not {1}, but {2}".format(*numberHolder)
DisneyStory = '''Jesse and her best friend {name} went to DisneyWorld today!
They saw a {noun1} in a show at the Magic Kingdom and ate a {adjective1} feast for dinner.
The next day I ran {adverb} to meet Mickey Mouse in his {noun2} and then that night
I gazed at the {randomnums} {adjective2} fireworks shooting from the {noun3}.'''
ZooStory = '''Amanda and her frenemy {name} went to the zoo last summer.
They saw a huge {noun1} and a tiny little {noun2}.
That night they decided to climb {adverb} into the {noun3} to get a closer look.
The zoo was {adjective1} at night, but they didn't care... until {randomnums} {adjective2}
apes yelled in their faces, making Amanda and {name} sprint all the way back home.'''
story = random.choice([DisneyStory, ZooStory])
print(story.format_map(vars()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment