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 trialmitchell clarke
867 PointsTask 2
lines 1-3 task 1 passes, when lines 4-5 added during task 2 error occurs saying "task 1 no longer passing. Tried a few variations to the code and can't get it to work. task 1 "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." Task 2 "OK, one more. Add an else to your if. In the else, set admitted to False."
admitted = None
if age >= 13:
admitted = 'True'
else:
admitted = 'False'
2 Answers
Kyler Smith
10,110 PointsPython's language was created for ease and readability. Indentation is very specific and required for everything. With that being said, your else clause is indented too far in. Try removing the tab for only this line.
admitted = None
if age >= 13:
admitted = 'True'
else: # Unindented is causing the error here
admitted = 'False'
admitted = None
if age >= 13:
admitted = 'True'
else:
admitted = 'False'
nathanielcusano
9,808 Pointsadmitted= None
if age >= 13:
admitted = True
else:
admitted = False # Notice true and false are boolean values not strings, remove the quotes around them