Really lost on


I am really lost on this one as well, I get the same error try again, just cannot seem to get it.


Think back on what you've learned about comparisons and conditional statements, such as if..elif. The exercise starts with this skeleton:

def greater_less_equal_5(answer):
    if ________:
        return 1
    elif ________:          
        return -1
        return 0

The instructions spell it out what we should be writing in place of the 'blanks' (the underscore lines need to be replaced with a comparison).

Give it a try and show us your code if it does not pass.


this is what I input, ive tried many options, answer gives back 1 1 1 none, -1 -1 -1 none, all saying output options is 0 or 1 (depending on original input) instead of -1 when asnwer is 3

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

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


Okay, but what did the instructions ask us to do? Certainly not repeat the example in the lesson text. Give them another read:


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.

Pay particular note to the parameter, answer in the function definition. That is the variable the above instructions are alluding to.


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