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 triallucy mclean
773 Pointsif else elif not ... task help please :)
Im stuck... could someone help.
Im not sure how I would make this true. I think i have the if statement right.
Thanks
admitted = None
if age => 13:
lucy mclean
773 PointsHey so i tried this..
and put
admitted = None
if age > 13: admitted = 'true'
and its still not working.. what i am doing wrong..
error is - Make sure admitted
is set to the True
boolean, not a string.
2 Answers
Alex Diaz
4,930 PointsI can't tell by how your codes in the comment but first make sure the admitted = 'true' is under the if statement. Second of all, it's giving you that error because True and "true" are NOT the same thing. True is a boolean and "true" is a string. So this is how that should look once you set admitted a True
admitted = None
if age > 13:
admitted = True
lucy mclean
773 PointsGot it !! Thank you so much! :D
Alex Diaz
4,930 PointsAlex Diaz
4,930 PointsOkay, you just need one more line of code, it's going to be under that if statement. So in python you can set variables that already have a value to another value afterwards. Here's an example
In the example, x is already equal to 5 but with the if statement, since it's true, i'm setting x to another value.
So under that if statement, just make admitted equal to True.
Hope I helped :D