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

yunus emre erdem
yunus emre erdem
575 Points

stuck again...

admitted = None age = 22 if age>13: admitted = True elif age = 13: admitted = True else: admitted = False

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

2 Answers

Timothy Donley
seal-mask
.a{fill-rule:evenodd;}techdegree
Timothy Donley
Python Web Development Techdegree Student 1,365 Points
admitted = None
if age >= 13:
    admitted = True
else:
    admitted = False

this is the correct code to pass task 1 and 2 the wording is bit weird but later in the track you will understand that he is mimicking an input.

see the computer is making the Variable age. its like the user of your script is typing in the age on the other side. so you don't make the age variable.

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

this would be the correct way to write it with logic that your using but have >= eliminates unnecessary lines of logic.

The operator >= is greater than or equal too, so if you use that you can remove your elif statement. Also it doesn't want you to change admitted to False, so remove that as well. Also the formatting is off in general. elif and else should be in line with the if statement, but you don't actually need those for this challenge.