Mad Libs SyntaxError


#1

Hey! im new to codecademy, and im have a problem “solving” the Mad Libs
i have a SyntaxError
"$ python Madlibs.py, file “Madlibs.py”, line 6. print = “Madlibs is starting up! ^ SyntaxError, invalid syntax.”

The code /


"""
The programs creates a story

Author: Ofri
"""
print = "Mad Libs is starting! "

name = raw_input('Enter a name: ')
abj1 = raw_input("Enter an adjective: ")
abj2 = raw_input("Enter another adjective: ")
abj3 = raw_input("Enter one more adjective: ")
verb = raw_input("Enter a verb: ")
noun = raw_input("Enter a noun: ")
noun2 = raw_input("Enter another noun: ")
animal = raw_input("Enter an animal: ")
food = raw_input("Enter a food: ")
fruit = raw_input("Enter a fruit: ")
superh = raw_input("Enter a superhero name: ")
country = raw_input("Enter a country: ")
dessert = raw_input("Enter a dessert: ")
year = raw_input("Enter a year: ")

# The template for the story

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 STORY % (name, adj1, adj2, animal, food, verb, noun, fruit, adj3, name, superh, name, country, name, dessert, name, year, noun2)



please help… :sweat:


#2

You don’t need an = sign when using a print statement so

print "Mad Libs is starting! "

should work.


#3

Do you have any more questions?


#4

i have another error…
NameError: name adj1 is not defined

"""
The programs creates a story

Author: Ofri
"""
print "Mad Libs is starting! "

name = raw_input("Enter a name: ")
> abj1 = raw_input("Enter an adjective: ")
> abj2 = raw_input("Enter another adjective: ")
> abj3 = raw_input("Enter one more adjective: ")
verb = raw_input("Enter a verb: ")
noun = raw_input("Enter a noun: ")
noun2 = raw_input("Enter another noun: ")
animal = raw_input("Enter an animal: ")
food = raw_input("Enter a food: ")
fruit = raw_input("Enter a fruit: ")
superh = raw_input("Enter a superhero name: ")
country = raw_input("Enter a country: ")
dessert = raw_input("Enter a dessert: ")
year = raw_input("Enter a year: ")

# The template for the story

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 STORY % (name, adj1, adj2, animal, food, verb, noun, fruit, adj3, name, superh, name, country, name, dessert, name, year, noun2)

NVM FOUND IT …

abj1


#5

Did you input someting for the adj1?


#6

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