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

Stefan Vaziri
Stefan Vaziri
17,453 Points

Not working

This seems to work on my console and gives me "False" but I keep on getting an error message on here. What am I doing wrong here?

conditions.py
admitted = True
age = 10
if age >= 13:
  print("True")
else:
  print("False")
naiara gonzalez
naiara gonzalez
16,778 Points

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

5 Answers

Hi, It does not ask you to create the age variable. Also, Instead of printing True and False you have to change the value of admitted to True or False depending whether age is greater than 13 or not.

admitted = None
if age >= 13:
  admitted = True
else:
  admitted = False
Andrey Chernykh
PLUS
Andrey Chernykh
Courses Plus Student 2,552 Points

I'm going to create a variable named age.

I need you to make an if condition that sets admitted to True if age is 13 or more.

You don't have to print anything you just need to set admitted to True or False

admitted = None
age = 10
if age >= 13:
  admitted = True
else:
  admitted = False
Anish Walawalkar
Anish Walawalkar
8,534 Points

this should fix it:

admitted = None

if age >= 13:
  admitted = True
else:
  admitted = False
Stefan Vaziri
Stefan Vaziri
17,453 Points

I was looking at the other dude's response since he responded before you. Was able to figure it out. Thanks.

naiara gonzalez
naiara gonzalez
16,778 Points

This worked for me: admitted = None age = 14 if age >= 13: admitted = True else: admitted = False