What is wrong with what I typed below?

https://learn.codechangers.com/learn/groups/162/courses/51/resources/9024

When using nested if/else statements in python and the directions are Write a function called can_ride that takes two integer parameters, age, and height. Have the function return True if the person is 10 or older and is between 4 and 6 feet tall, False otherwise, what is wrong with what I typed below?
What I typed:
def can_ride(age, height):
if age > 10:
height > 4 < 6
return True
else:
return False

to check the height, you need if (we always need if or elif if we want to compare), and to do two comparisons (taller then 4 feet and smaller then 6 feet) we need the and operator

1 Like

I fixed what you said to fix and it keeps on saying this:
AssertionError: False is not true. Check your logic and try again. What does this mean? Is there anything else wrong with my code? My new typed code is typed below.

def can_ride(age, height):
    i = age and height
    if age > 10:
        if height > 4 and height < 6:
            return True
    else:
        return False

this line:

i = age and height

doesn’t do anything, i would remove it

1 Like

I removed it and it still says what it said before.

if you want my help, show me what you have done + error you get

i can’t see what you do, to help i need to see this

1 Like

For the nested if/else statements I typed:

def can_ride(age, height):
    if age > 10:
        if height > 4 and height < 6:
            return True
    else:
        return False

It says:
AssertionError: False is not true : Check your logic and try again.

problem can’t be reproduced:

what i am i missing that i can’t reproduce the error?

1 Like

Would giving you the exact directions to the assignment be helpful?

The exact Instructions are:

Write a function called can_ride that takes two integer parameters, age, and height. Have the function return True if the person is 10 or older and is between 4 and 6 feet tall, False otherwise.

Function Name

can_ride

Parameters

age: an integer value
height: an integer value

Return Value

Return True if the age is greater than or equal to 10 and height is between 4 and 6, otherwise, return False

Did you see the repl.it code i posted:

https://repl.it/K4RZ

it works fine there, is your submit going through some sort of validation like here on codecademy?

1 Like

I figured it out. The answer ended up being:
def can_ride(age, height):
if age >= 10:
if height >= 4 and height <= 6:
return True
else:
return False
else:
return False
Thank you for the help anyway.