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 trialSamuel Peltz
865 PointsAnother misleading question in my opinion
age is not defined yet and it says "i'm going to create a variable age" i need help
admitted = None
if age < 13:
admitted == True
2 Answers
andren
28,558 PointsWhen the code checker runs your code it will define the age
variable before running your code. So even though you don't see age
being declared within the code you can use it within the script, that's what the challenge means when it states it will create it for you.
The reason why your code fails is that:
You check if
age
is less than 13, when the task asked you to check ifage
was greater than or equal to 13.You use == instead of =. == is used to compare two values, = is used to assign a value.
If you fix those two issues like this:
admitted = None
if age >= 13: # Check if age is greater or equal to 13
admitted = True # Set admitted to True
Then you will be able to pass the first task.
Jason Anders
Treehouse Moderator 145,860 PointsHi Samuel,
I'm not sure what you find misleading? The instructions clearly state what to do, and you have done it, except your code has one syntax error and one logic error.
- The instructions say to "assign" the value of
True
toadmitted
if the condition passes, but you are using a comparison operator not an assignment operator. - The challenge says to check if the
age
is 13 or greater, but you are checking to see ifage
is less than 13.
Just fix those two things up and your code will pass.
Keep Coding! :)