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 trialBrian Young
5,708 PointsSyntaxError: invalid syntax when adding the try/except
Code was running just fine till I added this code.
def remove_from_list():
show_list()
what_to_remove = input("What would you like to remove?\n> "
try:
shopping_list.remove(what_to_remove)
except ValueError:
pass
show_list()
Now when I first opened this file I found that I needed to remove alot of spaces and add tabs because I was getting alot of indentation errors, but the code was running correctly until I added the function. I have the indentation guides turned on to help with the issue I was having with the indentation errors, but I don't think I've gotten the syntax wrong here.
Have I gotten something wrong here...?
Shreyas Papinwar
2,371 PointsShreyas Papinwar
2,371 PointsOn line 3 you didn't close input().