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

Emilio Andere
Emilio Andere
495 Points

Why is this wrong

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

3 Answers

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points
  • Add an else to your if.
  • In the else, set admitted to False.

Remember to add : after if and else statements + don't forget to indent correctly

Emilio Andere
Emilio Andere
495 Points

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

But isn't this correct Henrik? It already has an else statement to false. and indented

https://teamtreehouse.com/library/python-basics/logic-in-python/conditional-value

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

looks like you are forgetting colons ( : )

example of if-statement

# this is just an example
if num == 250:  # notice the : at the end
    print('Something random')  # notice the indentation
else:  # notice the : at the end (again)
    print('Another random text')  # this needs to be indented too
Emilio Andere
Emilio Andere
495 Points

thanks for all your help, its still not working, but thanks.