Can someone explain that the importance of lambda in this format of sorting tuples? Further, what exactly does each element of this sorting method mean?
sorted(authorlist, key = lambda tup: tup[0], reverse = True)
I know that reverse =
True allows for the list of tuples to be sorted in decending order, the tup[0]
indicates what index you want to sort by, and that the first parameter is the tuple/list, but what does key = lambda
mean and why is tuple referred to as tup
?
Thanks!