Python Mad Libs


Hi, I’m having trouble understanding what the issue is. I keep getting this error message:
Traceback (most recent call last):
File “”, line 26, in
print STORY % (name, adjone, adjtwo, animal
, food, verb, nounone, fruit, adjthree, name, s
uperhero, name, country, name, dessert, name, y
ear, nountwo)
ValueError: unsupported format character ‘w’ (0
x77) at index 15

Can someone help? Thank you!


STORY = “This morning % woke up feeling %. ‘It is going to be a % day!’ Outside, a bunch of %s were protesting to keep % in stores. They began to % to the rhythm of the %, which made all the %s very %. Concerned, % texted %, who flew % to % and dropped % in a puddle of frozen %. % woke up in the year %, in a world where %s ruled the world.”

print “Mad Libs has started.”
name = raw_input("Enter a name: ")
adjone = raw_input("Enter an adjective: ")
adjtwo = raw_input("Enter a second adjective: ")
adjthree = raw_input("Enter one more adjective: ")
verb = raw_input("Enter a verb: ")
nounone = raw_input("Enter a noun: ")
nountwo = raw_input("Enter another noun: ")
animal = raw_input("Enter an animal: ")
food = raw_input("Enter a food: ")
fruit = raw_input("Enter a fruit: ")
superhero = raw_input("Enter a superhero: ")
country = raw_input("Enter a country: ")
dessert = raw_input("Enter a dessert: ")
year = raw_input("Enter a year: ")

print STORY % (name, adjone, adjtwo, animal, food, verb, nounone, fruit, adjthree, name, superhero, name, country, name, dessert, name, year, nountwo).

<do not remove the three backticks above>


Missing format string

This morning %s woke ...

Be sure to the leave the s on,

all the %s very 

as in,

all the %ss very


Thank you for the response. I did what you said, but it’s still coming back with:
ValueError: unsupported format character ‘t’ (0
x74) at index 144


Why are you using t as a format character? Use %s since all the parameters are strings.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.