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

Kris Fisher
Kris Fisher
1,901 Points

i don't understand this question

I passed this part last week and got all the way to loops but because i forgot everything learned a week ago, i had to restart Python basics. Now I've worked my way this far and i just don't get what I'm supposed to do

conditions.py
admitted = age
if age > 13
    print(admitted = True)

2 Answers

Russell Sawyer
seal-mask
.a{fill-rule:evenodd;}techdegree
Russell Sawyer
Front End Web Development Techdegree Student 15,705 Points

It's important to read the question carefully.

First, the variable age is set behind the scenes.

Second, admitted = none needs to stay the same since it was added for you.

Third, unless the challenge asks you to print something, adding a print statement will make the challenge think something is wrong.

Fourth, the challenge is asking to create an if statement that sets admitted to True if age is greater than or equal to 13. Don't forget the = sign. :)

admitted = None

if age >= 13:
    admitted = True
Kris Fisher
Kris Fisher
1,901 Points

Thanks so much. I had it that way before except I missed the ":".

Daniel Propp
Daniel Propp
30 Points

I'm going to create a variable named age. I need you to make an if condition that sets admitted to True if age is 13 or more. Its not asking you to print, it only asking you to turn admitted True IF the age is equal to 13 and greater

If it isnt greater than or equal to 13, set admitted to false. You need to look out for the formatting on the else statements, if you indent it, the challenge isnt correct. Since else is basically part of the if statement, you need to put it in alignment with the if statement as well. –––––––––––––––––––––––––––––

admitted = None
#if age is greater than or equal to 13
if age >= 13:
    #set admitted to true
    admitted = True
else:
    admitted = False