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 trialDavid Calvert
2,088 PointsChallenge 1 2/2
admitted = None if age > 12: admitted = True else: admitted = False Makes step 1/2 fail when 1/2 was admitted = None if age > 12: admitted = True
admitted = None
if age > 12:
admitted = True
else:
admitted = False
2 Answers
Brandon Jaus
13,681 PointsYeah like Chris mentioned above it is your else
that needs to be dedented to be at the same tab stop as the if
. However, a way to do this with fewer lines of code would be to do something like this:
admitted = False
if age > 12:
admitted = True
This would allow you to remove the else
block altogether.
Chris Freeman
Treehouse Moderator 68,441 PointsHi! It looks like your else
is intended too far. It should align with the if
.