0
Answer this with explanation pls🙏🏼
def myfunc(n): return abs(n - 50) thislist = [100, 50, 65, 82, 23] thislist.sort(key = myfunc) print(thislist)
1 Réponse
+ 5
thislist is a list that is sorted by myfunc() function .
100 => abs(100-50) = 50
50 => abs(50-50) = 0
65 => abs(65-50) = 15
82 => abs(82-50) = 32
23 => abs(23-50) = 27
After sort 50,65,23,82,100