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

Stuck Again

When I try to run this, this message appears in the comment box 'Bummer! Don't set the age variable, I'll do that for you.' And I don't see whats wrong with my code so if anyone could help me, much appreciated

conditions.py
admitted = None
age = 21
if age > 13:
    admitted = True
else:
    admitted = False

Hi Jayden, it just means don't use the line age=21 (maybe you used it for testing?). Just remove that line. Also, challenge says "set admitted = True for 13 or above" , so you may need to change your comparison operator.

1 Answer

Ryan S
Ryan S
27,276 Points

Hi Jayden,

'Bummer! Don't set the age variable, I'll do that for you.'

Not all challenge error messages are as descriptive as this one, but it is describing exactly what is wrong with your code.

The challenge will set an 'age' variable for you. For some reason, setting your own age variable (age = 21) passes the first task, but now it is the reason the second task won't pass. You will need to delete that line.

'age' is created behind the scenes. You don't know what its value will be. You are only instructed to check if it is greater than 13.

Hope this helps.

Edit: Sashi Shah is correct about your comparison operator. The instructions ask you to check if age is 13 or more. Your current comparison operator passed the first task because you essentially tricked the code checker by overwriting the 'age' value, but it will not pass the second task.