Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlan Sea
6,781 Pointsshow_list() not defined.
Why does it keep telling me that the show_list() method call on line 29 of shopping_list_2.py is undefined? The def looks good to me. What am I missing? Thanks in advance!
2 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsWhen parsing your code for the first time, line 29 references show_list()
before it is defined on line 38. Move the show_list()
definition into the beginning of the code. it's also a good practice to place all function definitions before regular code.
Alan Sea
6,781 PointsSo, then, just to clarify, that call doesn't simply point to method's definition, regardless of where the definition is in the code???
Chris Freeman
Treehouse Moderator 68,441 PointsCorrect. References are simply pointers to objects in the "namespace". So the referral is looked up on the namespace of objects. If it hasn't yet been defined it will raise an error.