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

traolach trewhella
PLUS
traolach trewhella
Courses Plus Student 835 Points

some help on the if statement.

so do i use the age var cause on the line of instructions is said i'm going to create a var named age what did i miss and what is this function if going to do as far as w'righting code or making a web sit

conditions.py
admitted = None
admitted = True
if age > 13

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

You're very close here! As you know there are many services that require you to be 13 years or older to use. Mostly American-based. Examples are Facebook, Steam, and the creation of an Apple ID. All we're asking here is if the user is thirteen years or older. But they made the age variable for you in advance outside of your code. And the guys and gals at Treehouse are going to send values into the age variable to test it. So your code should work for any value they send. Here's the code you need:

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

Here we start by setting admitted to None. Then we check the age. If the person is age thirteen or older we set admitted to True. This translates into us allowing them access to our hypothetical services somewhere else in our code.

Hope that helps!

traolach trewhella
traolach trewhella
Courses Plus Student 835 Points

this is the best! thanks your doing a great job aat explaining and now this makes sense!!!