def median(x,y,z):
print(x,y,z)
if x>y:
w = x
x = y
y=w
print(x,y,z)
if z<x:
return x
if z<y:
return z
returny
assert median(3,1,2) == 2
if x >y:
w = x
x = y
y=w
This code replaces x
and y
when x
is greater than y
.(The first and second arguments of the function median
are arranged in ascending order.)
© 2024 OneMinuteCode. All rights reserved.