Python Python Basics (2015) Logic in Python Conditional Value

Sean Frye
Sean Frye
1,062 Points

What am I doing wrong?

Thanks for the help on the previous task. I was able to get it finally when I didn't have a bunch of distractions in my way. However, I feel like I am doing this right, but clearly I'm not. I don't understand.

conditions.py
admitted = None
if age >= 13:
    admitted = True
    elif < 13:
        admitted = False

2 Answers

Hoessein Abd
Hoessein Abd
Python Web Development Techdegree Student 12,278 Points

Your if statement is correct. The problem is in your elif statement and the indenting.

The 2nd challenge is asking you to write an else statement not an elif, to check if age is not bigger or not equal to 13. so you dont need to write an elif condition because anything that isn't 13 or bigger than 13 will be covered in else.

admitted = None
if age >= 13:
    admitted = True
else:
    admitted = False
Sean Frye
Sean Frye
1,062 Points

That is what I am supposed to do? I'm starting to hate Python. Seriously? I entered the exact same thing as I tried and tried to do this, but the only way to fix it was to <BACKSPACE> several times to put all the wording in place. Damn! Python is insanely picky!

Hoessein Abd
Hoessein Abd
Python Web Development Techdegree Student 12,278 Points

Hey Sean,

Do you have Pycharm installed? I'd suggest installing the community edition and do your code challenges in there it gives you more information as to what you're doing wrong. It spots mistakes like these immediately. If youre done just copy it to treehouse.

Sean Frye
Sean Frye
1,062 Points

Dude! Thanks! I appreciate that! I'll definitely install it. Sorry, I was just reacting out of anger and frustration. I don't actually hate Python. I can't hate it when I need to learn it or some other form of coding to eventually have a successful career. Pycharm huh? Is that a web extension or an app?