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

why is task one no longer satisfying

why is this code wrong?

conditions.py
admitted = None
if age >= 13:
    admitted = True
    age = 12
if age >= 13:
        admitted = True
        else:
            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