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

Alex Durham
PLUS
Alex Durham
Courses Plus Student 456 Points

if statement

can someone tell me what is wrong with this thanks!

conditions.py
admitted = None
if admitted >=13:
    else "admitted" = false:

1 Answer

Samuel Ferree
Samuel Ferree
31,722 Points

you're "else" is nested inside the "if" block, not after it. You need an indented block of code to execute when the if is true, then the "else" statement at the same indent level, and then the else block indented once more.

if condition:
  var = true
else:
  var = false

also, in your "else" block, you don't need to put admitted in quotes. currently that is a literal string value, not a varibale.

else:
  admitted = false