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

Dan Sause
Dan Sause
3,695 Points

IF/ELSE Python Basics Code Challenge

What am I doing wrong here? I keep getting the error message saying "Task 1 no longer passes."

conditions.py
admitted = None

if age >= 13: admitted = True
  else: admitted = False

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Dan,

The problem lies with your indentation. Python is very specific with the indentation. The way you have the code written, you just need to remove the indentation from the else statement, and you are also missing the semicolons at the end of the statements.

Just a hint, the convention with Python coding is line break and indentation for different blocks of code. It is not common to do an entire if / else statement using one line syntax.

So, your code is correct except for the indent, but it would also follow the common rules of Python to have it this way:

admitted = None

if age >= 13:
  admitted = True;
else:
  admitted = False;

Hope this helps. Keep Coding! :) :dizzy:

Joey Feldhaus
Joey Feldhaus
2,220 Points

I had the same problem. Only way I could get it to work is if i set the else: admitted = () ... instead of admitted = false