Stuck at 14. I got 99 problems, but a switch ain't one


I do not know how to answer this particular exercise. Can someone help me out?

def greater_less_equal_5(answer):
    if ________:
        return 1
    elif ________:          
        return -1
        return 0
print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)



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.

you have to replace ________ with a condition.

for the if block condition should be whether or not answer is greater than 5

for the elif block condition should be whether or not answer is less than 5

have a look at the lesson example too :slight_smile:


Hi, thank you for your assistance, could you give me an example of the condition?


def greater_less_equal_5(answer):

you took a parameter named answer but you didn't use that in the function.The argument you pass for the function is not useful if you don't use the parameter.

If you look at the instruction carefully then you'll see that you are told to check if answer(the parameter) is greater than 5 .

note: Always create your own topic.Don't post on other's topic.

read this it'll help you to make good topic :slight_smile:


what if we want to know is 4 equal in value to 5
or is 10 greater than 9 ?

we use comparators to check

if 4==5:
  print True

here 4==5 is a condition.if the condition is True then it'll print the statement.

if 10>9:
  print True

here 10>9 is a condition.

I recommend that you look at the previous lessons .


i still couldn't get it T.T stuck on this step


You should create a new topic for your problems.
you need to post your code too


.................. . . .. . . . . . . . . . . . . . . . . . .


Shouldnt the walk through explain or have a "read this" before expecting a user to know what that means, its quite frustrating as a user to be asked a question and you don't know what the word means. Define how a flibbertygibbly is different that a heffalump... ummm.


what am i doing wrong here?


Comparators are <,>,==,!=,<=,>= they compares two defined values.In your code You didn’t mention answer as a comparative variable ,which is a parameter in the given function.


Please correct me if I’m wrong, but have we covered anything so far that taught us how to identify active ‘terms’ in existing code? I’m asking because I don’t recall us covering anything so far that would result in us knowing to add the word ‘answer’ in the IF lines. I did, but I put the word between ‘apostrophes’ because that’s what I knew to do from a different scripting language. I see other uses attempts seem to suggest this info has not been covered yet.

So I ask; have we covered anything so far that taught us how to identify (and use) active ‘terms’ in existing code?


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