How to get the correct output


#1



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


#2

the function parameter will hold the value passed on the function call:

def greater_less_equal_5(answer):
    print answer

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

see? so you could compare answer to 5, this way, your function is able to tell if the value is greater or less then 5


#3

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