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

Brendan Flynn
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Flynn
Front End Web Development Techdegree Graduate 20,193 Points

What am I missing to make this Else statement work?

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

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

3 Answers

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,720 Points

You are very close, I think the challenge failed because 'none' should be 'None'

None requires capitalization, just like True and False do.

Another issue might be the spacing in the 'if' block appears to be inconsistent with the 'else' block.

Spacing in Python can be a little frustrating at first, but it does keep code very readable and consistent.

Best of luck with Python, it's a lot of fun!

admitted = None
if age >= 13:
    admitted = True
else:
    admitted = False
Jeff Muday
Jeff Muday
Treehouse Moderator 28,720 Points

hehehe, a good IDE will syntax-highlight these inconsistencies. I use Wingware, but another excellent choice is PyCharm EDU. A good IDE can increase productivity, but some people love going old-school on vi, emacs, and nano!