Madlibs: type error: not all arguments converted during string formatting


#1
"""user input story, computerized mab libs"""

print "Mab Libs running..."
#NAME
name = raw_input("Enter a name: ")

ADJECTIVES

adjective1 = raw_input("Enter an adjective: ")
adjective2 = raw_input("Enter another adjective: ")
adjective3 = raw_input("Enter one more adjective: ")

VERBS

verb1 = raw_input("Enter a verb: ")
verb2 = raw_input("Enter another verb: ")
verb3 = raw_input("Enter one more verb: ")

NOUNS

noun1 = raw_input("Enter a noun: ")
noun2 = raw_input("Enter another noun: ")
noun3 = raw_input("Enter one more noun: ")
noun4 = raw_input("Enter the last noun: ")

ANIMAL

animal = raw_input("Enter an animal: ")

FOOD

food = raw_input("Enter a food: ")

FRUIT

fruit = raw_input("Enter a fruit: ")

NUMBER

number = raw_input("Enter a number: ")

SUPERHERO NAME

supername = raw_input("Enter a superhero name: ")

COUNTRY

country = raw_input("Enter a country: ")

DESSERT

dessert = raw_input("Enter a dessert: ")

YEAR

year = raw_input("Enter a year: ")

The template for the story

STORY = "This morning I woke up and felt %s because %s was going to finally %s over the big %s %s. On the other side of the %s were many %ss protesting to keep %s in stores. The crowd began to $s to the rythym of the %s, which made all of the %ss very $s. %s tried to %s into the sewers and found %s rats. Needing help, %s quickly called %s. %s appeared and saved %s by flying to %s and dropping %s into a puddle of %s. %s then fell asleep and woke up in the year %s, in a world where %ss ruled the world."

print STORY %(adjective1,name,verb1,adjective2,noun1,noun2,animal,food,verb2,noun3,fruit,adjective3,name,verb3,number,name,supername,supername,name,country,name,dessert,name,year,noun4)


#2

Hi @britneyok ,

What is the purpose of the $s character sequences that you have inside the STORY string? You need to match each variable to a %s format sequence.


#3

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