Need Help with "elif" stements


#1



Oops, try again. It looks like your function output 1 instead of -1 when answer is 3. Make sure you filled in the if and elif statements correctly!


Below is my Instructions
01. On line 2, fill in the if statement to check if answer is greater than 5.
02. On line 4, fill in the elif so that the function outputs -1 if answer is less than 5.


def greater_less_equal_5(answer):
    if ________:
        return 1
    elif ________:          
        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 structure is there, now just fill in the conditions?


#3

Thank you for your reply but look at my code below, b/c Im still getting the error when I run the code
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)


#4

Switch your returns around.


#5

Thanks...it worked.
according to the lesion, the "elif" statement is only checked if the original "if" statement is false. My mistake was that I had the "if" statement set to true.

anyway...thank you


#8