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 Python Basics (2015) Shopping List App Second Shopping List App

Why does a SyntaxError: invalid syntax show up under while True, only after adding the add_to_list(new_item) function

The program runs normal if the functions is not there, but as soon as it's put in place, a syntax error pops up with a caret under E of while.

1 Answer

Steven Parker
Steven Parker
231,236 Points

You didn't share your code or workspace, so this is just a guess, but I helped someone earlier today with a similar error.

In that post , there were mismatched parentheses on the line above, which got detected as a syntax error on the while.

Maybe there's something similar going on in your case. Check the previous line for a possible typo or other error.