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

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.