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


#1

So guy can you briefly explain what does this code do cuz I cant get the hang on it.
The things I understood: so we def that greater_less_equal_5 is answer, it made us check if answer is greater than 5 and if answer is less than 5. But the things I didnt understand are: what do the numbers in the returns stand for

    if answer>5:
        return 1
    elif answer<5:          
        return -1
    else:
        return 0

the 1 -1 and 0
and the other thing i didnt understand is:

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

what are those numbers in the () what use do they have ?
those are probably stupid question and they were explained somewhere in the test


#2

oh and does return has the same use as print ?


#3

Hi @microsolver81105,

These will be explained in detail in the coming unit about Functions :wink:

Hope it helps! :smiley:


#4

this should be helpful

   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)


#5

Thank you , it did help me.