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

I cant understand what i'm supposed to do here and how ?? Since admitted is declared as None how can it ever be true ??

As the title says how is it possible ? And in the task it says " i'm going to create a variable named age." The "i'm" is not me its the speaker so i assume since i dont see the variable in the code it has already declare it and its secret so i wont know or it's a typing mistake and i need to declare it ?

conditions.py
admitted = None
if admitted =< age:

admitted = None is declared by default not me only the if statements is done by me.

1 Answer

The challenge instructs you to create an if statement that checks the age variable (created by the instructor, you don't need to declare or initialize the variable) against the value of 13. If age is equal to or greater than ( >= ) 13, set the variable admitted to True.

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

The admitted variable was initialized as None just as a "placeholder", it is still possible to alter it's value later in the program.

Just to add to this, Python takes the declarations in order of appearance. So when Ted explains that "the admitted variable was initialized as None just as a 'placeholder'" since the if-statement comes after that declaration, admitted will now be True because it's the most recent declaration. Basically overriding the "admitted = None" declaration.

I hope this helps.