Practice Control Flow: Write a function to return the largest of three number

Hey,

I was practicing the control flow and I couldn’t get past this question.

Write a function called largest_number that takes three integer inputs, x , y , and z . Have this function, as its name implies, return the largest of the three numbers.

This is my code:

def largest_number(x,y,z):
  if x > y and x > z:
    return x
  elif y > x and y > z:
    return y
  elif z > x and z > y:
    return z

print(largest_number(38,23,4))

It is working fine, the output is showing the largest number. But still i am getting error that says `

largest_number` did not return the largest value.

could you post the exercise url?

what if you have something like:

print(largest_number(15,15,4))

none of your conditions are true, so nothing is returned.

2 Likes