Python Python Basics (2015) Logic in Python Conditional Value

Setting a variable to true or false

Tried this approach to set a variable to true or false for if -else logic, but it's not running. help

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

1 Answer

Hi Ifeoma! Your else statement is indented. Unindent it and your code should work just fine. As it is, your else statement is set to happen inside of your if statement so it will only happen if age is greater than or equal to 13. Let me know if you need more help. :)

It worked! Thanks nakalkucing :)

Welcome! And thank YOU for the best answer. :)