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

yannis sousanis
yannis sousanis
7,199 Points

What am I doing wrong?

I use my computer shell and it works but Im probably missing something

conditions.py
admitted = None
age = 10
if age  >= 13 :
    admitted = True
else :
    admitted = False

5 Answers

Read the challenge description carefully again. You should see that he says he'll create the variable age, which means you don't need to worry about it he just wants you to do the if/else statements

Dimitris

a. No you don't. I literally just did it before I answered that question to make sure.

admitted = None
if age  >= 13:
    admitted = True

That block of code passes the test for part 1

b. Yes and it does. Neither requires age to be declared.

c. What's your code? Because I just did OP's code minus the age variable declaration (for the 3rd time now) and didn't get a single issue

admitted = None
age=18
if age > 13:
    admitted = True

This is my part 1 and it gets a pass/green

Should it not catch the following two errors? a. I declared variable age b. I should have used >=

Thanks for the quick help Randy Eichelberger

Addition:

admitted = None

if age > 13:
    admitted = True

---> This gives an error in part 1 - which is what led me to believe you need the age (real cause of error: not using ">="

I see your problem. You're only catching if it's greater than 13, not if it's greater than or equal to

Yep, you are right... And, I did not catch the fact that I needed >= so I just went ahead and tried adding age=18. Which worked... That is a bug, it should not give a pass - right?

Yes, but, this is part 2 of the exercise and: a) part 1 can only be solved if you declare the age b) part 2 is supposed to build on what you have completed in part 1. c) even if you remove the age declaration, you get an error.

I am having the same issue

yannis sousanis
yannis sousanis
7,199 Points

Thank you everyone for your support and answers