Run ❯
Get your
own Python
server
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
def myfunc(n): return abs(10-n) a = (5, 3, 1, 11, 2, 12, 17) x = sorted(a, key=myfunc) print(x)
[11, 12, 5, 3, 17, 2, 1]