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

Can someone please help with this If statement from this exercise?

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

This is my code below (sorry if not formatted correctly) but why does it start with admitted = none?

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

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

3 Answers

Julian Gutierrez
Julian Gutierrez
19,201 Points

You're close, there is no need to use return, simply set admitted to True.

admitted = None

if age >= 13:
    admitted = True

Sorry created a new post below but does the top line admitted = none remain as is provided in this exercise?

Steven Parker
Steven Parker
231,275 Points

Starting with admitted set to True establishes a default value in case the condition does not change it.

But the instructions asked for a condition that "sets admitted to True if age is 13 or more", and the condition in the code above test for more than 13.

And you would only return from inside a function. Here you only need a simple assignment.

I am confused about the first line 'admitted = none' that is already in this exercise. Should this top line remain in this exercise before the If statement??