Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Conditional Value

traolach trewhella
PLUS
traolach trewhella
Courses Plus Student 835 Points

I DID THIS RIGHT STILL DIDINT WORK ANSWERS

CORRECT ME IF IM WRONG

conditions.py
admitted = None
if age >= 13:
  admitted = True;
  else:
  admitted = False;

2 Answers

Matt Nickele
Matt Nickele
468 Points

The else should be equal with the if and no semi-colons

Fable Turas
Fable Turas
9,405 Points

There are 3 things that I see here.

The first 2 are minor things that strictly speaking won't effect your outcome, but are important to note when writing good Python.

The first: Python doesn't use semi-colons to close out lines.

The second: You do not need an 'else' statement to fulfill the request of the challenge since you already have a value for 'admitted' that is Falsey, so you only need to change it to True when the True condition is met. If the condition isn't met it will stay set to the Falsey value and 'admitted' will evaluate to False in any subsequent condition without you writing the extra lines to set an explicit 'else'.

The third thing I see is most likely the reason your code is not passing though. Python is a white space based language. Your tabs are important. If you over or under tab, your code will break.