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

Joshua Sklodowska
Joshua Sklodowska
1,146 Points

I need you to make an if condition that sets admitted to True if age is 13 or

1.) I don't understand why the starts off with admitted = None

2.) It also states that someone else is going to give an age variable. Doesn't that mean I don't have to make one?

3.) When I type,

if age >= 13:

I don't get the ellipses when I press enter. When I space 4 times to type in,

print(admitted=True)

(which I don't think I'm supposed to do)

I keep getting an error message that says,

invalid syntax(<string>, line 2

I'm pretty sure I've misunderstood the question. But, even so, what is wrong with my if statement?

conditions.py
admitted = None
age = 13
>>> if age >= 13: 
  ...    print(admitted=True)

3 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Josh is correct.

The different symbols you'll see will vary with the editor you are using. Generally one means tab and one means space (usually > = tab and . = space. You don't type this into the challenge.

Python is also not a fan of tabs. It likes spaces ... 4 spaces for an indent to be picky. So, like Josh said, delete the symbols you added, and there should be no indent (4 space) before your if.

You are correct in not using the print statement. The challenge wants the variable admitted changed (not printed) if the condition returns True. So, the completed and corrected code for Task one is as follows:

admitted = None
age = 13
if age >= 13:
    admitted = True

Hope this helps you move forward. Keep Coding! :)

Josh Keenan
Josh Keenan
20,315 Points

The fact I missed the last bit makes me doubt myself :S

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Nah... We all miss stuff every now and again. No worries. :see_no_evil:

Josh Keenan
Josh Keenan
20,315 Points

You don't need the*>>>* or . . .

Remove them then it should work!