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

lucy mclean
lucy mclean
773 Points

if else elif not ... task help please :)

Im stuck... could someone help.

Im not sure how I would make this true. I think i have the if statement right.

Thanks

conditions.py
admitted = None
if age => 13:
Alex Diaz
Alex Diaz
4,930 Points

Okay, you just need one more line of code, it's going to be under that if statement. So in python you can set variables that already have a value to another value afterwards. Here's an example

x = 5

if x > 4:
    x = "Hi"

In the example, x is already equal to 5 but with the if statement, since it's true, i'm setting x to another value.

So under that if statement, just make admitted equal to True.

Hope I helped :D

lucy mclean
lucy mclean
773 Points

Hey so i tried this..

and put

admitted = None

if age > 13: admitted = 'true'

and its still not working.. what i am doing wrong.. error is - Make sure admitted is set to the True boolean, not a string.

2 Answers

Alex Diaz
Alex Diaz
4,930 Points

I can't tell by how your codes in the comment but first make sure the admitted = 'true' is under the if statement. Second of all, it's giving you that error because True and "true" are NOT the same thing. True is a boolean and "true" is a string. So this is how that should look once you set admitted a True

admitted = None

if age > 13:
    admitted = True
lucy mclean
lucy mclean
773 Points

Got it !! Thank you so much! :D