Python Madlib project


Good day,

I am currently stuck on the madlibs project. I have completed all the steps but when i run the program, it ends up saying “NameError”. What am i doing wrong?

Strings and Console Output


animals is not defined, if we look at line 20 we see the reason (check spelling)



If we look at the print statement, it will work in Python 2, but not in Python 3. Python 2 does not need parens around the STORY object, so they can be removed. If you wish to make the code compatible with Python 3, then wrap the entire expression in parens.

print (STORY % (argument list))


if i don’t add them it gives me the same error as before except it wasn’t animals but STORY


Apart from the spelling correction, as long as you have 18 arguments to match the placeholders in the STORY template, this will suffice…

print STORY % (your_argument_list)


Thanks for the help because I was having the same issue. Question: let’s say that I wanted to play again and I wanted to enter different answers, how would I do that?


Just run the code again…



Thanks for the help, mtf


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