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) 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,858 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
229,644 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
229,644 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