Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Conditional Value

Jonathan Camacho
Jonathan Camacho
1,504 Points

Why does it keep saying "invalid syntax(<string>, line 1)"?

I dont know how to avoid the ---- error. It's ---- me off.

Jason Anders
Jason Anders
Treehouse Moderator 145,631 Points

Hey 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

2 Answers

Steven Parker
Steven Parker
218,691 Points

:mailbox_with_mail: Hi, 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
Jonathan Camacho
1,504 Points

admitted = 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
Steven Parker
218,691 Points

Remember 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. :arrow_heading_down:

But even without the formatting, it looks like you forgot the colon (":") at the end of the if line.

Jonathan Camacho
Jonathan Camacho
1,504 Points

hahaha, yeah, that was it! Thanks