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

Jt Miller
Jt Miller
1,242 Points

If statements.

It tells me to create a var named age and then make admitted true if age is 13 or over and I'm stuck.

admitted = None
age = 13

if age > 13:
    admitted = True
Jt Miller
Jt Miller
1,242 Points

Figured it out I wasn't reading it correctly it wanted me to make admitted true if it was equal to 13 or greater than so

if age >= 13: admitted = True

I didn't read the equal the first time around.

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! First off, you have misread the instructions. Take a look at the first sentence:

I'm going to create a variable named age.

This means that Treehouse is making that variable and they're going to send in a number to the age (possibly several times with several numbers) to make sure that your code passes in each case. But in this line you're overwriting what they're sending in, so it needs to be removed.

age = 13

Also, your if statement is checking if the person is older than 13. But the statement should be checking if the person is 13 or older. We want anyone who is 13 or older to be admitted. So a 13 year old should be able to get in. But your code requires them to be a minimum of 14 to get in.

I feel like you can get it with these hints, but let me know if you're still stuck! :sparkles:

Omar Farag
Omar Farag
4,573 Points

Yes, thanks for letting me know. I read it over again and realized my mistake. That's why I deleted my post. Thanks for letting me know ?

Lol just realized that you weren't talking to me, Even though I got a notification for it. Sorry about that.