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

Mamadou Diene
seal-mask
.a{fill-rule:evenodd;}techdegree
Mamadou Diene
Python Web Development Techdegree Student 415 Points

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

Andrey Misikhin
Andrey Misikhin
16,529 Points
admitted = 'admitted'
age =14
if age >= 13:
    print(admitted)
Sharina Jones
PLUS
Sharina Jones
Courses Plus Student 18,771 Points

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)
Anthony Shrope
seal-mask
.a{fill-rule:evenodd;}techdegree
Anthony Shrope
Python Web Development Techdegree Student 693 Points

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