What am i doing wrong? i need help


I dont understand with the issue and i need help

Oops, try again. 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!

def greater_less_equal_5(answer):
    if 5 > 6 :
        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)


look at this code:

# function deceleration 
def greater_less_equal_5(answer):
    print answer

# function call
print greater_less_equal_5(4)

at function call, we pass an argument (4), which is then copied into the function parameter (answer)

this way, we can call our function with a lot of different numbers to see if they greater, lesser or equal to 5

This means we need to compare 5 with our function parameter in our if and elif condition. This means the function will also work for 3 and 7 if we supply those numbers as argument on function call


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