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

Taebin You
Taebin You
4,786 Points

setting a variable false in else statement

it says Task 1 is no longer passing Task 1 was just with if part without else part

conditions.py
admitted = None
if age >= 13 :
    admitted = "True"
    else:
        admitted = ""

Hi Kenneth Love

This challenge seems to be passing with incorrect values for the admitted variable.

3 Answers

Anthony Liu
Anthony Liu
11,374 Points

Indentations matter in python. You want if and the corresponding elif or else statements to be indented the same amount.

Also, admitted should be set to the boolean True without quotes and set to False in the else block.

Belve Marks
Belve Marks
7,332 Points

There's a typo in the code. This will throw an error. Go over this for typos and it should be fixed.

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Added checks for the booleans, thanks Jason Anello!

And like others have said, your indentation matters. Make sure things line up properly.

Srini Radhakrishnan
Srini Radhakrishnan
584 Points

Not sure what you mean by set to the boolean true

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

True isn't the same as "True". The first is a boolean and the second is a string.