i am trying to print the median of three numbers but when the test case for example is the numbers 2,1,2 it gives none but when i try 2,2,1 it gives me the right answer which is 2, so how do i fix this code?
def median(a,b,c):
if a>b:
if a>c:
if b>c:
return b
else:
return c
elif c>a:
if a>b:
return a
else:
return b
elif b>a:
if b>c:
if a>c:
return a
else:
return c
elif c>b:
if a>b:
return a
else:
return b
elif a==c:
return a
elif a==b:
return a
elif b==c:
return b
print(median(2,1,2))