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 trialLeon Wright
723 Pointsage variable not being created for me as instructions say, but creating one myself gives an error message
The instructions say "I am going to create a variable called age" but there is no variable in the coding interface. If I create my own variable called age I can pass task one but then when I finish task two I get the message "don't set the age variable I will do that for you" If I do not set an age variable myself in task one, my if statement does not change admitted to True and I can not pass, presumably because I do not have an age variable set for the if statement to check. Removing the age variable from task two or removing the age variable's value gives me the message that task one is no longer working.
admitted = None
age =
if age > 13:
admitted = True
else:
admitted = False
1 Answer
Steven Parker
231,275 PointsThe challenge really does create that variable.
But only during the "check work" process, and not in a way that you would see.
It looks like your real issue is in your comparison operator. The challenge instructions say to set "admitted to True
if age is 13 or more." But the operator you are using (">
") means "greater than". So that covers the "or more", but it would not include the case when the value is equal to 13.
Leon Wright
723 PointsLeon Wright
723 PointsI noticed that immediately after posting this question. Then when I went back and tried it again I forgot to put my ":" after my if statement leading me to think that it was definitely broken, haha. Thanks for jumping in to help!!!