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

Musheer Ahmad
Musheer Ahmad
345 Points

Not recognizing code.

It seems the system is not able to recognize my code.

conditions.py
admitted = None

if admitted != age:
    admitted = True
else:
    print("Hi")

1 Answer

Hi there, the below code worked for me. It seems that you're not comparing age to 13, so the if statement has nothing to return. Then, I'm not sure why you have it printing "Hi". When I looked at the challenge it said the else: statement to evaluate to False. Good luck!

admitted = None
if age >= 13:
    admitted = True
else:
    admitted = False
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi Julio! I took the liberty of changing your comment to an answer. This marks the answer as answered in the forums and also allows for voting on your answer and possible assignment of "Best Answer". Thanks for helping out in the Community! :sparkles:

Darren Taylor
Darren Taylor
1,052 Points

Julio, thanks for your help, your example worked for me too!