Help me!


#1

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

"Elif" is short for "else if." It means exactly what it sounds like: "otherwise, if the following expression is true, do this!"

if 8 > 9:
print "I don't get printed!"
elif 8 < 9:
print "I get printed!"
else:
print "I also don't get printed!"
In the example above, the elif statement is only checked if the original if statement if False.

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

so when I was trying to figure out the problem It keeps telling me that I am wrong please help

here is the code i put:
def greater_less_equal_5(answer):
if 5:
return 1
elif 6:
return -1
else:
return 0

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


#3

answer needs to be involved in the comparison, if answer greater then (>) 5, return 1


#4

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