If else statement in Python, for the code shared my answer should be 1, -1 and 0 while am getting 1's


def greater_less_equal_5(answer):
    if (15>5):
        return 1
    elif (4<5):          
        return -1
        return 0
print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)


well 15 is always greater then 5, so your if statement is always true, so 1 gets always returned. I would compare your function parameter (answer) with 5 in both your if and elif


@gigarunner53563 Please start indenting your code when you post. It will make it easier for us.


I’m also having the same difficulty.