I found this code from online and tries to find what is the logic.But i didn't get it.
from collections import Counter
arr = [4,3,1,1,3,3,2]
k = 3
c = Counter(arr)
print(c)
s = sorted(arr,key = lambda x:(c[x],x))
print(s)
print(len(set(s[k:])))
what the line
s = sorted(arr,key = lambda x:(c[x],x))
do? what is the use of (c[x],x) in the code. The output given by the code is correct. But i dont know what the lambda function do in this code.