Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Conditional Value

Christian Geib
Christian Geib
826 Points

Challenge task 1 of 2 -not sure how to go about age true or false

No quite sure what I am supposed to do here. The question appear sto ask me not to set an age and instead worry about the IF condition. My apporoach

if not age >= 13: admitted = False else: admitted = True

does not seem to work . Any advice?

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

2 Answers

admitted = None
if age >= 13:
  admitted = True
else:
  admitted = False
Christian Geib
Christian Geib
826 Points

Thanks, Thayer, for the quick, super helpful response. Much appreciated!

Christian Geib
Christian Geib
826 Points

Btw, Thayer, when I enter the code you suggested,

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

and I click on 'Check work', I receive the following error notice: Bummer! invalid syntax (<string>, line 5)

Any idea why that is?

suliman alkous
PLUS
suliman alkous
Courses Plus Student 5,139 Points

check the spaces else should be on same column of "if"

admitted = None

if age >= 13:
    admitted = True
else:
    admitted = False
Christian Geib
Christian Geib
826 Points

Thanks Suliman for the quick response & your instruction, your rock! Much appreciated!

Christian Geib
Christian Geib
826 Points

Btw, Thayer, when I enter the code you suggested,

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

and I click on 'Check work', I receive the following error notice: Bummer! invalid syntax (<string>, line 5)

Any idea why that is?