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 trialAnne Manning
5,415 PointsI keep getting message OOPS task on is no longer passing?
I cant seem to get past this section to continue on with the training. I believe that my code is correct. Any help/direction will be appreciated.
admitted = None
if age >= 13:
admitted = True
else:
admitted = False
3 Answers
Haider Ali
Python Development Techdegree Graduate 24,728 PointsHi there Anne, in python, blocks of code are specified by indentation. If you were using JavaScript, you would put curly braces around a block of code. However, in python, blocks of code are specified by just using indentation so python knows which code belongs to what. In your code, the else
block is indented inside the if
block and shouldn't be. If an else
and if
are part of the same conditional statement, they should be indented to the same level. Here is how it should look:
admitted = None
if age >= 13:
admitted = True
else:
admitted = False
If you have any other questions, please leave a comment.
Thanks,
Haider
Jason Anders
Treehouse Moderator 145,860 PointsHey Anne,
While the code is correct, the indentation is off. Python is indent specific when it comes to programming syntax. Right now, the way you have it written, the else
clause is inside the if
statement. You want the else
to be on its own. Just remove the indent on your else
clause.
Hope that helps. Keep Coding.
Anne Manning
5,415 PointsWooHoo! That worked!!! Thank you very much!!
Levis Vazquez
961 PointsThanks for your comment, I was stuck here.
Ary de Oliveira
28,298 Pointsadmitted = None
if age >= 13:
admitted = True
else:
admitted = False
Anne Manning
5,415 PointsAnne Manning
5,415 PointsThank you very much. I forgot the indentation!