Mad Libs Error: unsupported format character 'w' (0x77)


#1

Hi guys, I'm stuck!!

Code:

name = raw_input("What is your name?")
first_adj = raw_input("Enter an adjective: ")
second_adj = raw_input("Enter an adjective: ")
third_adj = raw_input("Enter an adjective: ")
first_verb = raw_input("Ether a verb: ")
second_verb = raw_input("Enter a verb: ")
third_verb = raw_input("Enter a verb: ")
first_noun = raw_input("Enter a noun: ")
second_noun = raw_input("Enter a noun: ")
third_noun = raw_input("Enter a noun: ")
fourth_noun = raw_input("Enter a noun: ")
animal = raw_input("What is your animal? ")
food = raw_input("what is your faivourite food? ")
fruit = raw_input("What is your faivourite fruit? ")
number = raw_input("Lukcy number? ")
hero_name = raw_input("Do you have a superhero name? ")
country = raw_input("Least faivourite country? ")
dessert = raw_input("Least faivourite deseert? ")
year = raw_input("Predict the year you will die ")

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 % (first_adj, name, first_verb, second_adj, first_noun, second_noun, animal, food, second_verb, third_noun, fruit, third_adj, name, third_verb, number, name, hero_name, hero_name, name, country, name, dessert, name, year, fourth_noun,)

Console: --->

Traceback (most recent call last):
File "Madlibs.py", line 23, in
print STORY % (first_adj, name, first_verb, secon
d_adj, first_noun, second_noun, animal, food, second_
verb, third_noun, fruit, third_adj, name, third_verb,
number, name, hero_name, hero_name, name, country, n
ame, dessert, name, year, fourth_noun,)
ValueError: unsupported format character 'w' (0x77) a
t index 45

Please help!! I had a different unsupported chareceter before, it was 'a' (0x76) I think, but now its changed after some playing around.

Thank you!! :smiley:


#2

Just got it to work, but no idea how.... LOL oh well. Tis the life of a programmer I hear.


#3

So seeing as it works now but I don't know how... spot the difference anyone? haha!

name = raw_input("What is your name?")
first_adj = raw_input("Enter an adjective: ")
second_adj = raw_input("Enter an adjective: ")
third_adj = raw_input("Enter an adjective: ")
first_verb = raw_input("Ether a verb: ")
second_verb = raw_input("Enter a verb: ")
third_verb = raw_input("Enter a verb: ")
first_noun = raw_input("Enter a noun: ")
second_noun = raw_input("Enter a noun: ")
third_noun = raw_input("Enter a noun: ")
fourth_noun = raw_input("Enter a noun: ")
animal = raw_input("What is your animal? ")
food = raw_input("what is your faivourite food? ")
fruit = raw_input("What is your faivourite fruit? ")
number = raw_input("Lukcy number? ")
hero_name = raw_input("Do you have a superhero name? ")
country = raw_input("Least faivourite country? ")
dessert = raw_input("Least faivourite deseert? ")
year = raw_input("Predict the year you will die ")

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 % (first_adj, name, first_verb, second_adj, first_noun, second_noun, animal, food, second_verb, third_noun, fruit, third_adj, name, third_verb, number, name, hero_name, hero_name, name, country, name, dessert, name, year, fourth_noun,)


#4

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