Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (Retired) Shopping List Shopping List Project

Python Shopping list - Syntax error line 6 ... but it's the same as the instructor has... I think.

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("Added! List has {} items.".format(len(shopping_list)))

print("here's your list: ")

for item in shopping_list:

Line 6 holds is the line with ' while True: '

I get this error.

   File "shopping_list.py", line 6
      while True:
SyntaxError: invalid syntax

I'm not really sure what is going on here...

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 67,989 Points

Keep in mind it is often the preceding line that causes the syntax error. It looks like you're missing a paren on the print statement.

Oh, I feel like a goof. Thank you. I guess, after having been at this treehouse thing for the last 5 hours... it's time for a break.