Help with error message on "Relational Operators II" exercise

I have a problem with a error message after running the following code :

def greather_than(x, y):
  if x>y:
    return x
  if y>x:
    return y
  if x==y:
    return "These numbers are the same"

the error message is Did you remember to define greater_than ? My impression is that a function is defined by the commande def function_name(input1,input2):

Please explain where i am wrong.

Thank you

the function name needs to be correct, check it for spelling/typos.


this put me off for a long time I did not know what went wrong.

at the end i use give me the answer and got it.

my question can some one tell me how I can read past the error message that puts me off.

Or how I need to interpret such messages.

def greater_than(x, y):
  if x > y:
    return x
  if y > x:
    return y
  if x == y:
    return y

Expected `greater_than` with test inputs -7 and -7 to return “These numbers are the same”

Adding the actually function call:

print greater_than(-7, -7)

to see what is actually returned helps

analyzing the error message also helps. Break it down in small pieces and make sure you understand every piece

for the rest, lots of practice and gaining experience helps :slight_smile: Sometimes you just need to push trough

1 Like

That message originated from Codecademy’s submission correctness test (SCT) for this exercise, rather than as a complaint from the Python interpreter, so it is not a standard error message. Note that the instructions include this:

… If x and y are equal, return the string

"These numbers are the same"

Evidently, the SCT test made this function call, which did not generate the expected return value.

greater_than(-7, -7)
1 Like

tank you for the info this helps a lot

1 Like