I got 101 problems but a switch ain't one Python



It keeps on saying It looks like your function output 0 instead of -1 when answer is 3. Make sure you filled in the if and elif statements correctly!. But I changed it and it still didn’t work.

I expect it to work well

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


from the instructions:

On line 2, fill in the if statement to check if answer is greater than 5

i don’t see you answer?


The console says it’s five but it doesn’t work


we have 3 print statements:

print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)

and if we then look at the output:


they all produce 1, the first print statement 4 isn’t greater then 5, in fact, 4 is smaller then 5, so -1 should be returned when the function is called with argument value of 4, which is why you need to use answer in your comparison/conditions, this will be explained later


Im having this exact same issue and haven’t been able to resolve it for a while now. Any luck?


if you have a question, you can create a new (linked) topic rather then hijacking an existing topic which causes clutter


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.