Having problem in I Got 99 Problems, But a Switch Ain't One


I have some trouble solving the question in I Got 99 Problems, But a Switch Ain't One


This popped up when I run the code:
Oops, try again. It looks like your function output 1 instead of -1 when answer is 3. Make sure you filled in the if and elif statements correctly!

But I think my code is correct.

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

Can anybody help me? Thank you!


And this is the whole page of my question.


well, looking at this code:

if answer < 5:
   return 1

3 is smaller then 5, so the condition evaluates to true, 1 is returned. Seems your conditions aren't correct


Thank you! I just reversed my code. It worked!