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 trialArturo Barradas
Courses Plus Student 7,526 PointsWhat am I doing wrong?
Question one passed correctly but question two is not
admitted = None
age = 13
if age == 13:
admitted = True
else:
admitted = False
4 Answers
Katie Wood
19,141 PointsHi there,
I think the problem is that you're assigning a value to the age variable - the first challenge question says that it's doing that in the background - you don't need it there. It's most likely failing because your code is writing over the value that is set behind the scenes that the challenge is using to test. If you remove the age=13 line, it should pass.
Jennifer Nordell
Treehouse TeacherHi there! The answer by Katie is partially correct. You are overwriting what the challenge is sending in. But above and beyond that, the condition is supposed to allow anyone in who is 13 or older. This means the condition should be if age >= 13:
Hope this helps!
Katie Wood
19,141 PointsOoh, you're right, good catch - I had just done this one so I thought I didn't need to read the directions again. That'll teach me - thanks, Jennifer!
Arturo Barradas
Courses Plus Student 7,526 PointsThank you very much for your answer, however I have removed the age = 13 sentence and the system is now responding Oops! It looks like Task 1 is no longer passing.
Katie Wood
19,141 PointsThat's right, there was one more thing - Jennifer caught that one. The challenge asks for 13 or older, which means you also need to have >= instead of ==.
Arturo Barradas
Courses Plus Student 7,526 PointsThanks you very much, from here now I'm going to pay more attention to the instructions.