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

I'm getting a NameError unless my input is typed as a String. Even when I copy & paste the exact same code in video

code :shopping_list = []

print("What should we pick up at the store?") print("Enter 'DONE' to stop adding items.")

while True:

new_item = input("> ")

if new_item == 'DONE':


print("Here's your list:")

for item in shopping_list: print(item)

2 Answers

Ryan S
Ryan S
27,276 Points

Hi Ross,

It sounds like you are using Python 2. If so, you will need to use the raw_input() function instead.

input() does not work the same in Python 2 as Python 3.

I would recommend using Python 3 while following along in these courses.

Ross Thompson
Ross Thompson
7,706 Points

Thanks Ryan, big noob error on my part. I'm using a python 2 interpreter to read python 3 code!

Tate Price
Tate Price
Courses Plus Student 9,987 Points

can you post exactly what the error message says