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!

Recommended Answers

All 4 Replies

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

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

Wonder why you did that:

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

You had perfectly good variable names already.

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.