Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Conditional Value

why is task one no longer satisfying

why is this code wrong?

admitted = None
if age >= 13:
    admitted = True
    age = 12
if age >= 13:
        admitted = True
            admitted = False

1 Answer

Steven Merriel
Steven Merriel
2,563 Points

Hello Priyanka, I believe there are a couple of things that will assist your code to run.

  1. Currently you are testing age to see if it is greater than 13 twice, I think what you would like to do is if they are above 13 set 'admitted' to True if they are younger then set it to false. This can be achieved with a smaller amount of code and just one if statement python admitted = None if age >= 13: admitted = True age = 12 else: admitted = False
  2. Please note that the else statement should be inline with the if statement. In your code it is indented and this will mean that it won't run

I hope this helps