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!

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 (Retired) Putting the "Fun" Back in "Function" Shopping List Redux

Public Service Announcement

When run on OS X v10.10 with Python v2.7.6, I get:

Traceback (most recent call last): File "shopping_list.py", line 19, in <module> new_item = input("> ") File "<string>", line 1, in <module> NameError: name 'Apples' is not defined

The same code passes in the Treehouse Workspace, which uses Python v3.4. I've read there were big changes from 2.x to 3.x but don't know enough as to why this happens.

No biggie, but I spent a few minutes on it so I though I'd pass it along.

1 Answer

item = input("> ") is a python 3 syntax

use raw_input instead!

That explains it. Thanks!