154k views
2 votes
What is wrong with my code...

def bigger(b,c):
if b > c:
return b
else:
return c
# if b is returned, then b >c
# if c is returned, then c > b

def biggest(a,b,c):
return bigger(a,bigger(b,c))


def median(a,b,c):
if biggest(a,b,c) == c and bigger(a,b) ==a:
# c > b and c > a
# a > b
return a
elif biggest(a,b,c) == c and bigger(a,b)==b:
#
return b
else:
return c

1 Answer

1 vote
I'm not sure of the problem that you had in the first place, but I can point out that in your "bigger" method, if a number is greater than one then it is bigger, however the else statement says that the number *can* also be equal[==] to the second argument, so for example bigger(1,1) it would check if 1 > 1 and return false, so it will return that b[the second 1] is bigger! Hope this helps :D
User Anan
by
8.0k points