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

Boolean Failure

Step 1 asks me to do this:

admitted = None Age = 14

if age > 13: admitted = True

this statement for step 1 needs to end True.

step 2 tells me to add

Else: admitted = False

and the error I'm getting: "admitted does not equal False" makes me think that the else statement needs to happen to be successful.

However, it won't accept it either way. If the answer is True then it's not False like it should be. But if it's False then step 1 is wrong because it's no longer True.

Someone help fix this paradox.

conditions.py
admitted = None
age = 14

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

Did you try to put break line in the if and else functions?

Didn't think it'd fix this problem but I tried anyways. It stops the code challenge from accepts it as a valid answer.

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Chris.

Your code is correct except for 2 things:

First, you added an age variable that the challenge did not ask for. (Challenges don't like code being added it didn't want). So, just delete that line.

Second, the challenge wants you to check if the age is 13 or greater than 13, so you just need to modify your if statement to be >=.

Otherwise, you're good to go. :)

admitted = None

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

only thing was the age variable. age > 13 was fine. Thanks for the help.