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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![perix](https://secure.gravatar.com/avatar/e359660bf88819f19e1e2677161cd4e5?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
perix
795 PointsSyntax error for no clear reason
I'm having a syntax error and I can't understand why:
shopping_list = []
def add_to_list(item):
shopping_list.append(item)
def show_help():
print("What should we pick up at the store")
print("""
Enter 'DONE' to stop adding items.
Enter 'HELP' for this help.
""")
show_help()
while True:
new_item = input("> ")
if new_item.upper() == 'DONE':
break
elif new_item.upper() == 'HELP':
show_help()
continue
add_to_list(new_item)
treehouse:~/workspace$ python shopping_list.py
File "shopping_list.py", line 8
def show_help:
^
SyntaxError: invalid syntax
2 Answers
![Michael Hulet](https://uploads.teamtreehouse.com/production/profile-photos/672712/micro_me.jpg)
Michael Hulet
47,912 PointsMake sure you've saved your file here before running it, because the traceback that Python is complaining about looks different from what's in your file. The traceback shows show_help
being declared like this:
def show_help: # Note the lack of parentheses here
However, in the code you have above it, show_help
appears to be declared properly, with parentheses, and there should be no syntax error there. This suggests to me that you simply forgot to save your file after fixing it, which is a very easy thing to forget in Workspaces 🙂
![cesarmatta](https://uploads.teamtreehouse.com/production/profile-photos/4755812/micro_0.jpg)
cesarmatta
11,592 PointsYou need to add two )) after the """ in the show_help function.
I had the same problem, the error message is quiet misleading
Keith Korter
1,252 PointsKeith Korter
1,252 PointsI've saved my file and reloaded the workspace, and I too am getting this error.