Thursday, December 31, 2015

Program: Mad-Libs word game

The first things I'm programming on my own are Mad Libs  word games. They are fun to program and funny to play. I'll give out the code:

import easygui
easygui.msgbox("Hi, let's have a game of Mad Libs!")
word_1 = easygui.enterbox("Give me an adjective")
word_2 = easygui.enterbox("Give me a number - from 1 to 1000")
word_3 = easygui.enterbox("Give me a verb(ending in 'ing')or a noun(ending in 'es')")
word_4 = easygui.enterbox("Give me a number - from 1 to 1000")
word_5 = easygui.enterbox("Give me a verb(ending in 'ed')")
word_6 = easygui.enterbox("Give me a noun")
word_7 = easygui.enterbox("Give me another noun") 
word_8 = easygui.enterbox("Give me a verb(ending in 'ing')")
word_9 = easygui.enterbox("Give me a noun")
word_10 = easygui.enterbox("Give me an adverb")
easygui.msgbox("I went to tell my " + word_1)
easygui.msgbox("freinds that I just bought " + word_2)
easygui.msgbox("kite(s)! and asked them to fly them with me but the had to do their " + word_3)
easygui.msgbox("first, but said they could do it in " + word_4)
easygui.msgbox("hours, so I " + word_5)
easygui.msgbox("while I waited")
easygui.msgbox("then when they were ready we went to a " + word_6)
easygui.msgbox("to fly them, but when we were flying them one of the kites slipped out of one of the freind's hands and fell on top of a " + word_7)
easygui.msgbox("so I went to tell my dad who was " + word_8)
easygui.msgbox("and then he came out with a " + word_9)
easygui.msgbox("to get the kite so we could all enjoy flying them " + word_10)

The spacing might look messed up but I tested it and it works anyway.
I'll explain what the code mans in a few other posts I make.









No comments:

Post a Comment