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

omar talaat
PLUS
omar talaat
Courses Plus Student 171 Points

IF statement

admitted = None admitted = "true" age = 13 if (age >= 13) : print(admitted)

it is telling me to create a variable age and if this age is greater than or equal 13 assign true to admitted

conditions.py
admitted = None
admitted = "true"
age = 13
 if (age >= 13) :

1 Answer

  • First the admitted variable should only remain None ie: admitted = None so the admitted = "true" should come after the if statement
    also the value "true" is now a string value and no more a Boolean value True remove the quotes "true" and make it look like this True

  • Secondly the change your if format to look like this: if age >= 13:

  • together all should look like this:

     # Initialize the variables admitted and age...
    admitted = None
    age = 13
      # use conditional statement...
    if age >= 13:
       admitted = True     # admitted becomes true if age is greater or equals to 13