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

Unable to turn admitted to none


I can not make admitted to none

2 Answers

Hi Kevin,

The challenge isn't asking you to make "admitted" be "none". It's asking for an if/else statement that will update admitted from "None" to "True" or "False", depending on whether age is >= 13.

You can solve this Challenge with the following code:

admitted = None
#  The next line checks if the 'age' variable, which we can't see, if greater than or or equal to 13.
if age >= 13:
  #  Then we assign True to the 'admitted' variable as the result of the 'if' statement being true.  
  admitted = True
#  Part 2 of the Challenge asks for an 'else' code block;
  #  If the age being greater or equal to 13 is not true, then the below code will be executed.
  admitted = False

Please let me know if you have any questions about this!

Hi Evan,

Many thanks for your quick response. The reason I started thinking it meant for me to make "admitted" be "none" was that I had already tried your suggestion and it continues to provide me with the error being "Oops! It looks like Task 1 is no longer passing".

Even now that I re-do the entire excersie with the code you provided, the same error comes up.

Copying and pasting my code block above should pass the challenge (and did when I tested); did you remove the original admitted = None?

When I copy your code directly, it accepts what is written.

However when I do everything manually, even when I input identical code to yours, it declines and says Task 1 is no longer passing:

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

edit: found that when I removed spaces in front of else it accepted what I wrote.

Many thanks for the quick help ! Was my first time being stuck & posting here, didn't quite know how to post code here properly yet.

I see your problem there; the else block needs to be on the same indent as the if block.