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

Setting Variable To True If

I guess I am completely lost on this one.

conditions.py
admitted = None
age = 13
admitted is True if (age) >= 13

The challenge is make the variable True if the age is 13 or more.

3 Answers

Dave Harker
PLUS
Dave Harker
Courses Plus Student 15,510 Points

Hi Andrew,

In that challenge the 'age' variable will be set for you, no need to define / assign it. The conditional logic you have is OK, but the syntax is a bit off. Perhaps try something like:

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

Hope that helps. Keep coding :)

Dave

Is the challenge asking you to use an if conditional?

I believe the code should look similar to this.

if age>= (insert minimum age here) (insert the outcome ie 'x =true')

I actually done this challenge earlier... so I am still a newbie as well. however I believe that the instructor already set the variable 'age' behind the scenes. so in short, renaming the variable age is against the challenge.

also the if statement should read similar to this: if age is >= to 13 admitted = True.