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 trialhorus93
4,333 PointsSyntaxError: invalid syntax on line that looks identical to what I'm seeing in the video
So trying to follow along with the guys rapid fire pace in the video, first mistake I made was a pretty easy fix (indented some things a bit too far), but here I'm drawing a blank. it's not the indentation here, but it looks identical to what I'm seeing in the video following along so how it's giving me this doesn't seem to make sense to my neophyte brain.
===========================
File "shopping_list.py", line 61
if new_item.upper() == 'DONE': or new_item.upper() == 'QUIT':
^
SyntaxError: invalid syntax
===========================
edit (for some reason the error doesn't copy over the second line in a proper position, but the error arrow should be pointing to or on the line.
edit 2 - nevermind, I found the typo X***D
1 Answer
Michael Hulet
47,913 PointsWay to go on finding your own typo! Simple mistakes can be frustrating, but I promise that even the most experienced developers make them
For those who find this question and wonder what the typo is, it appears that there's an extra colon (:
) after "DONE"
on this line, which signals to Python that the line is over, but the condition continues immediately afterward, which is invalid. Removing this extra colon (:
) in the middle of the line should fix the issue