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

Alexander Pavlenko
Alexander Pavlenko
654 Points

I don't understand what I'm doing wrong. i passed task 1 and added: "else: admitted = False"

Can't figure out how to complete Task 2

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

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! There are two small issues here. One is your indentation, and one is that you're overwriting what they're testing. The else should be in line with the if. They are making the age variable and testing a number and we don't get to know what it is. By setting the age yourself, you are writing over what they are testing. So, if I fix the indentation and remove the age = 16, your code passes!

Hope this helps! :sparkles:

Alexander Pavlenko
Alexander Pavlenko
654 Points

Thanks a lot , Jennifer!All good now! Absence of line defining 'age' variable confused me:) And when i passed Task 1 i was falsely assured that everything there is correct:) Cheers!

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

It happens! Going forward, it's a good idea to not do anything that the challenge doesn't explicitly ask for. Even if functional, it can cause the challenge to fail :smiley: