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

what is wrong in my code

I think I have written correctly but it is showing an error

conditions.py
admitted=None
if(age>=13):
    admitted=True

3 Answers

Anjali Pasupathy
Anjali Pasupathy
28,883 Points

You're close, but your syntax is a little off. You need to remove the parentheses around the condition.

admitted=None
if age>=13:
    admitted=True

I hope this helps!

I'm not sure of the reason for this, but it doesn't work with () around the condition.

Do it like this:

if age >= 13:
    admitted = True
Sahil Sharma
Sahil Sharma
4,791 Points

You can edit out the parenthesis to make your code pass this level but in practice you should use parenthesis. Treehouse challenges have a criteria for passing a particular code, they match your code with the correct answer and check the output of a couple of inputs, in this case you have encountered a bug/error. PS: Try running the same code in workspaces or on your machine, because it should work.