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 trialLaknath Gunathilake
1,860 PointsI can't get the code on the shopping list to work
make a list to hold on to items
shopping_list=[]
print out instructions on how to use the app
print("what should I do today?") print("enter DONE to stop adding items.")
ask for new items
while True: new_item= input("> ")
add new items to our list
shopping_list.append(new_item)
be able to quit the app
print out the list
print("here's your list:") for each item in shopping_list: print(item)
I can't get the code in the video to work. when I run the code on the terminal it says there is a syntax error File "shopping_list.py", line 14
for each item in shopping_list:
^
SyntaxError: invalid syntax
1 Answer
Bob Buethe
3,276 PointsHi, Laknath --
"each" isn't a Python key word. The line should be "for item in shopping_list:"