Python Python Basics Logic in Python Conditional Value

CH. K Sri Krishna
CH. K Sri Krishna
474 Points

If This Then That

Challenge Task 1 of 2: If This Then That topic I'm going to create a variable named age. I need you to make an if condition that sets admitted to True if age is 13 or more.

Please help me in understanding and writing this code

conditions.py
admitted = None

1 Answer

Krishna Pratap Chouhan
Krishna Pratap Chouhan
15,101 Points

Ok i see why you might be confused here...

You don't have to create a age variable. Consider it already exists.

See the comment for more details.

the following code doesn't work either...

admitted = None

#I'm going to create a variable named age.
#age=1
#you dont have to do this part.

#I need you to make an if condition that sets admitted to True if age is 13 or more.
#if age >12
if age >= 13:
    admitted = True

try this code without any mention of age variable...

admitted = None

#I need you to make an if condition that sets admitted to True if age is 13 or more.
#if age >12
if age >= 13:
    admitted = True

Second task is here, try yourself, i am sure you'll do it after above confusion being handled. ...

...

...

...

...

...

...

admitted = None



#I need you to make an if condition that sets admitted to True if age is 13 or more.
#if age >12
if age >= 13:
    admitted = True
else:
    admitted = False