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

This seems pretty straight forward, but the variable admitted passes first check, but adding the second piece ...

of code reveals an error about the first task no longer pass.

the is my code admitted = None if age >= 13: admitted = True else admitted = False

conditions.py
admitted = None
if age >= 13:
    admitted = 1
    else admitted = 0

2 Answers

Steven Parker
Steven Parker
231,236 Points

The code automatically copied in from your challenge is different from what you added yourself. But the issues they (might) have in common (since one isn't formatted it's hard to be sure):

  • an "else" statement should start in the same column as the matching "if"
  • an "else" should be followed by a colon (:)
  • everything that the else controls should be on following lines and indented more than the "else" itself

Thank you for the little syntax clean up.