Help! i don't know what i'm doing wrong!


#1

Hello Everyone! I am so confused on what I am doing wrong. Please help me. I keep getting an error message that says that not all arguments were converted during the string formatting. My code is shown down below.

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


print 'Mad Libs has started'

name = raw_input('Enter a name: ')

adj1 = raw_input('Enter an adjective: ')
adj2 = raw_input('Enter an adjective: ')
adj3 = raw_input('Enter an adjective: ')

verb1 = raw_input('Enter a verb: ')

noun1 = raw_input('Enter a noun: ')
noun2 = raw_input('Enter a 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, adj1, adj2, animal, food, verb1, noun1, fruit, adj3, name, superhero, name, country, name, dessert, name, year, noun2)




#2

Hi @cloudrunner30480,

If not all arguments were converted during the string formatting, it is because there are an insufficient number of occurrences of the %s formatting specifier in the value of STORY to match all the variables contained within the parentheses in your final line of code. Check carefully for any typographical errors in the string that you assigned to STORY.


#3

As indicated by @appylpye, above, this proves out the theory…


Does this strike a chord?


#5

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