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 trialTerrence Masocha
1,217 PointsIf this then that
I'm going to create a variable named age.
I need to make an if condition that sets admitted to True if age is 13 or more.
admitted = None
please help me
admitted = None
age = 122
if age >= 13:
print("admitted is True!")
2 Answers
Jennifer Nordell
Treehouse TeacherYou're doing really well and you're very close here. Always keep in mind that challenges are very picky. They don't want you to set the value of age. They're going to do that to test your code, so you need to keep age open for any value they send. Right now you're overwriting what they send with àge = 122'. Also, they want you to set the value of admitted to true, not print that it's true. Take a look at my solution:
admitted = None
if age >= 13:
admitted = True
Terrence Masocha
1,217 Pointsthat was great Jennifer, thanks........ How can i add an ELSE to that IF Function to set admitted to FALSE
Rob B
11,677 PointsTerrence, If you read above you will see that Jennifer answered that very question in her first response to you.
Jennifer Nordell
Treehouse TeacherActually, I added that bit after he asked about the else. P The problem is I managed to put the comment in the wrong place! Woops!
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherIt's pretty straight-forward. Here's the rest with the else. Take a peek!