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 trialTaebin You
4,786 Pointssetting a variable false in else statement
it says Task 1 is no longer passing Task 1 was just with if part without else part
admitted = None
if age >= 13 :
admitted = "True"
else:
admitted = ""
3 Answers
Anthony Liu
11,374 PointsIndentations matter in python. You want if and the corresponding elif or else statements to be indented the same amount.
Jason Anello
Courses Plus Student 94,610 PointsAlso, admitted should be set to the boolean True without quotes and set to False in the else block.
Belve Marks
7,332 PointsThere's a typo in the code. This will throw an error. Go over this for typos and it should be fixed.
Kenneth Love
Treehouse Guest TeacherAdded checks for the booleans, thanks Jason Anello!
And like others have said, your indentation matters. Make sure things line up properly.
Srini Radhakrishnan
584 PointsNot sure what you mean by set to the boolean true
Kenneth Love
Treehouse Guest TeacherTrue
isn't the same as "True"
. The first is a boolean and the second is a string.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi Kenneth Love
This challenge seems to be passing with incorrect values for the
admitted
variable.