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
172,106 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

Tate Price
PRO
Tate Price
Pro Student 6,450 Points

Are you using python 2, or python 3?

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
PRO
Tate Price
Pro Student 6,450 Points

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

user_choice = input("> ")