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 trialBrandon Gibbs
9,636 PointsPython 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':
break
shopping_list.append(new_item)
print("Added! List has {} items.".format(len(shopping_list)))
continue
print("here's your list: ")
for item in shopping_list:
print(item)
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
Treehouse Moderator 68,441 PointsKeep 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.
Brandon Gibbs
9,636 PointsBrandon Gibbs
9,636 PointsOh, 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.