954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

New program: Monty Python Madlibs!

Based off the Self defence class skit:

# Filename: Madlibs.py
noun = raw_input("Type a noun: ")
verb = raw_input("Type a verb: ")
adjective = raw_input("Type an adjective: ")
sound_disgust = raw_input("Type a random sound of disgust, eg 'Uuurh': ")
noun1 = noun
verb1 = verb
adjective1 = adjective
moan = sound_disgust
print "The Madlibs Self Defence Class"
print
print "Today, we are going to learn how to defend ourselves against"
print "a %s." % noun1
print
print "But we did %s last week!" % noun1
print
print "%s! Too %s for %s are we?" % (moan, adjective1, noun1)
print "Tell me something! What if some nutter appeared out of nowhere,"
print "and tried to %s you with a %s! What then eh?" % (verb1, noun1)
print
print "THIS IS THE END OF MONTY PYTHON AD LIBS. GOOD DAY!"


This just resuts from me playing with tuples!
Hope you like it. The words I used, in prompt order were:

Noun: Anvil
Verb: Eat
adjective: random
moan: Eurgh!

chris99
Junior Poster
118 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

Looks like you are getting familiar with formatted strings and string input, great! Could be quite funny depending on what you put in!

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

Thanks. My first program is going down a treat I see!

chris99
Junior Poster
118 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

Wonder why you did that:

noun1 = noun
verb1 = verb
adjective1 = adjective
moan = sound_disgust

You had perfectly good variable names already.

bumsfeld
Nearly a Posting Virtuoso
1,445 posts since Jul 2005
Reputation Points: 404
Solved Threads: 184
 

Well, I had a slight problem with the code, that was a troubleshooting method that didn't work. I've been meaning to get rid of that...

chris99
Junior Poster
118 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You