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

I am stuck on this simple challenge. i don't know why the code is not working

code not working, please help\

conditions.py
admitted = None
age =14
if age >= 13:
    print('admitted')

2 Answers

admitted = 'admitted'
age =14
if age >= 13:
    print(admitted)

it still not passing, and it ask me to not change the code, but to just add to it

You used quotes in your print statement. That means you're passing print the string 'admitted' rather than the value of the variable.

To pass the value of the variable, call the print function on the variable without the quotes.

print(admitted)

You also need to change the value of admitted based on the result of the conditional. If the age is greater than 13, you need to set admitted to True. If it isn't, you need to set admitted to false.

admitted = None
age =14
if age >= 13:
    admitted = True
else
    admitted = False

Finally, you need to make sure you're indenting properly. You want to make sure that your print statement isn't in either the if or the else block. The prompt doesn't ask you to print, so I'm not sure if a print statement needs to be included.

admitted = None
age =14
if age >= 13:
    admitted = True
else:
    admitted = False

print(admitted)

to all you absolute NOOBS such as myself, don't forget to capitalize None, True, False. I missed that in the vid and have been stuck on such a simple, stupid error. frustrating