Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Conditional Value

Debdipta Dasgupta
Debdipta Dasgupta
431 Points

Couldn't understand where am I going wrong

I have solved the first part of the challenge.But in the second part of the challeng I can't understand where I am going wrong with the else function. Would appreciate your help with the second challenge

conditions.py
admitted = None

2 Answers

Carlos Federico Puebla Larregle
Carlos Federico Puebla Larregle
21,073 Points

You just need to add an "else" statement and assign the value False to the variable named "admitted". Do it like this:

admitted = None
if age >= 13:
    admitted = True
else:
    admitted = False
Debdipta Dasgupta
Debdipta Dasgupta
431 Points

Thank you so much for the help!!!!

Carlos Federico Puebla Larregle
Carlos Federico Puebla Larregle
21,073 Points

The variable "age" is going to be created for you, then you have to check if that "age" variable is greater of equal to the number 13. You could do it like this:

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

I hope that helps a little bit.

Debdipta Dasgupta
Debdipta Dasgupta
431 Points

I have solved this challenge.Where I got struck is the 2nd part of the challenge where else function will be used. Thanks