Run ❯
Get your
own Python
server
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
def myfunc(n): return abs(n - 50) thislist = [100, 50, 65, 82, 23] thislist.sort(key = myfunc) print(thislist)
[50, 65, 23, 82, 100]