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

Using Mac. Pasting my code from workspaces in terminal and getting Line 7 error from my new_item input

shopping_list = []

print("Enter items for your shopping List") print("Type in DONE when finished")

while True: new_item = input("> ") if new_item == "DONE": break shopping_list.append(new_item)

print("Here is your list!")

for item in shopping_list: print(item)

why am I getting an error in terminal? When I run the script it runs the first two print commands. But when I enter an item into the list I get a error from the line new_item = input("> "). This script runs fine in workspaces.

1 Answer

It could be that you are trying to run your code on Python 2 (which comes installed on Mac OS by default). The code you've written will only run on Python 3.