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 trialomar talaat
Courses Plus Student 171 PointsIF 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
admitted = None
admitted = "true"
age = 13
if (age >= 13) :
1 Answer
Gerard Nwazk
Courses Plus Student 2,833 PointsFirst the admitted variable should only remain None ie:
admitted = None
so theadmitted = "true"
should come after theif
statement
also the value"true"
is now a string value and no more a Boolean valueTrue
remove the quotes "true" and make it look like this TrueSecondly 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