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 trial

Python Python Basics (2015) Logic in Python Conditional Value

Bo Chen
PLUS
Bo Chen
Courses Plus Student 848 Points

How do you do this

On task one, it pops up with an error that says that the task must pass, so I set age to 13. But then on task two it pops up with an error that says not to set the age variable.

conditions.py
admitted = None
age = 13
if age >= 13:
    admitted = True
else:
    admitted = False

2 Answers

Josh Keenan
Josh Keenan
20,315 Points

Here's my solution:

admitted = None

if age >= 13:
    admitted = True
else:
    admitted = False

The age isn't something you create, the challenge just passes it in magically to test your code!

Gilbert Craig
Gilbert Craig
2,102 Points

the task does not ask you to declare a variable 'age' or assign a value to it, nor to provide and 'else' statement

If you remove the second and last 2 lines it will work

Bo Chen
Bo Chen
Courses Plus Student 848 Points

Just so you know, the last two lines of code were for the second task, but thanks for trying to help