I got 99 Problems, But a Switch Ain't one output question


#1


I figured out an answer to this exercise. But I am wondering about the output.
My code looks like this

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

The output says:
"-1
0
1
None"
My question is. Why does it say -1, 0 and 1 in that order? Shouldn't it be 1, -1 and 0 lastly?


#2

look at your function calls:

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

4 is smaller, so will print -1, 5 will print 0 and 6 will print 1

I don't see why this is a problem?


#3

That is the order of your function calls.

@stetim94 you're always faster :stuck_out_tongue:


#4

Wow. I guess my brain is just fried after a day of work..
Thanks for the quick answers!


#5