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 trialUnsubscribed User
7,260 PointsUnable to turn admitted to none
Dear,
I can not make admitted to none
2 Answers
Evan Demaris
64,262 PointsHi 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;
else:
# 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!
Unsubscribed User
7,260 PointsWhen 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
else:
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.
Evan Demaris
64,262 PointsI see your problem there; the else
block needs to be on the same indent as the if
block.
Unsubscribed User
7,260 PointsUnsubscribed User
7,260 PointsHi 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.
Evan Demaris
64,262 PointsEvan Demaris
64,262 PointsCopying and pasting my code block above should pass the challenge (and did when I tested); did you remove the original admitted = None?