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 trial

Python Python Basics (2015) Shopping List App Shopping List Introduction

Ross Thompson
Ross Thompson
7,706 Points

No matter what i type in past the "> ", I get NameError - 'word' is not defined.

CODE: print("This is your shopping list.") print("Please enter one item at a time and type 'Done' when your list is complete.")

shopping_list = []

while 1 > 0: user_choice = (input("> ") shopping_list.append(user_choice)

ERROR: Traceback (most recent call last): File "ShoppingList.py", line 9, in <module> user_choice = str(input("> ")) File "<string>", line 1, in <module> NameError: name 'cake' is not defined

Steven Parker
Steven Parker
231,275 Points

The error message and code shown don't seem to match. Be sure you're showing the right code.

Also, use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:
Or watch this video on code formatting.

2 Answers

Ross Thompson
Ross Thompson
7,706 Points

I'm writing python 3 but I'm starting to think my interpreter wants to read python 2?

Tate Price
PLUS
Tate Price
Courses Plus Student 9,987 Points

try changing user_choice = (input("> ") remove the extra ( and make it

user_choice = input("> ")