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

If This Then That

Challenge Task 1 of 2: If This Then That topic I'm going to create a variable named age. I need you to make an if condition that sets admitted to True if age is 13 or more.

Please help me in understanding and writing this code

conditions.py
admitted = None

1 Answer

Ok i see why you might be confused here...

You don't have to create a age variable. Consider it already exists.

See the comment for more details.

the following code doesn't work either...

admitted = None

#I'm going to create a variable named age.
#age=1
#you dont have to do this part.

#I need you to make an if condition that sets admitted to True if age is 13 or more.
#if age >12
if age >= 13:
    admitted = True

try this code without any mention of age variable...

admitted = None

#I need you to make an if condition that sets admitted to True if age is 13 or more.
#if age >12
if age >= 13:
    admitted = True

Second task is here, try yourself, i am sure you'll do it after above confusion being handled. ...

...

...

...

...

...

...

admitted = None



#I need you to make an if condition that sets admitted to True if age is 13 or more.
#if age >12
if age >= 13:
    admitted = True
else:
    admitted = False