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 trialJonathan Camacho
1,504 PointsWhy does it keep saying "invalid syntax(<string>, line 1)"?
I dont know how to avoid the ---- error. It's ---- me off.
2 Answers
Steven Parker
231,261 PointsHi, I got your request.
I would be happy to try to explain what is causing that error message, but I would need to see your code. Please post it here and I will come back and answer again.
In case you saw that code spoiler that was posted before it was removed, I'd suggest disregarding that and posting your code for analysis which will give you a better chance to learn something.
Jonathan Camacho
1,504 Pointsadmitted = None if age >= 13 admitted = True
That's my code at the moment. And it's saying "Bummer! invalid syntax (<string>, line 1) I have to set the variable admitted to True by using an if condition.
Steven Parker
231,261 PointsRemember to format your code so the spacing shows up properly (in Python, indentation is everything).
Use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area.
But even without the formatting, it looks like you forgot the colon (":
") at the end of the if line.
Jonathan Camacho
1,504 Pointshahaha, yeah, that was it! Thanks
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsHey Jonathan...
I understand that coding can sometimes lead to frustration, but please use appropriate language when posting in the forum. Many people of all ages use the Community, and appropriate language that is not offensive is expected from everyone! (I have modified your original post).
Also, if you would like help troubleshooting why you are receiving an error, you will have to provide the code you are using that is producing said error. Please refer to the Markdown Cheatsheet for how to properly format and post code blocks to the forum.
Thank you for your cooperation.
Jason Anders ~Treehouse Community Moderator