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

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?