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

Maggie Wolff
Maggie Wolff
495 Points

conditional value challenge task 1 of 2

I can't figure this out, and I looked through my notes.

conditions.py
admitted = None
age = '13'
if age == '13':
    admitted = true

2 Answers

Hi Maggie,

The challenge instructions mention that it will create an age variable for you so that's not something you have to do in your code.

For your if condition, you have to check if the age is 13 or more so you would need to use the >= operator, greater than or equal to.

And in python the boolean True and False values have to be capitalized.

You should be able to pass after making those changes but let me know if you're still stuck.

One more thing I forgot, you don't want to put quotes around the 13. That would make it a string but you want it to be an integer.

Maggie Wolff
Maggie Wolff
495 Points
admitted = None
if age >= 13:
    admitted = True
    else:
        admitted = False

it says there is something wrong with line 5

Ok, for the second task, you have the right code but it's indented too far. Indentation is very import in python because that controls where the code belongs.

Your else: and the admitted = False need to go back one level of indentation.

The else: should be lined up with the if