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 trialEmilio Andere
495 PointsWhy is this wrong
admitted = None if age >= 13 admitted = True else admitted = False
3 Answers
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points- Add an else to your if.
- In the else, set admitted to False.
Remember to add : after if and else statements + don't forget to indent correctly
Emilio Andere
495 Pointsthanks for all your help, its still not working, but thanks.
Henrik Christensen
Python Web Development Techdegree Student 38,322 Pointsadmitted = None
if age >= 13:
admitted = True
else:
admitted = False
Emilio Andere
495 PointsEmilio Andere
495 Pointsadmitted = None if age >= 13 admitted = True else admitted = False
But isn't this correct Henrik? It already has an else statement to false. and indented
https://teamtreehouse.com/library/python-basics/logic-in-python/conditional-value
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsHenrik Christensen
Python Web Development Techdegree Student 38,322 Pointslooks like you are forgetting colons ( : )
example of if-statement