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

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,074 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,074 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