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)

11th May 2021, 9:03 AM
Disha Jain
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
11th May 2021, 9:26 AM
TOLUENE
TOLUENE - avatar