What Is Anonymous Function?: Anonymous Functions Can Accept Inputs and Return The Outputs, Just
What Is Anonymous Function?: Anonymous Functions Can Accept Inputs and Return The Outputs, Just
These functions help reduce the number of lines of the code when
compared to named Python functions.
The Python language, like other programming languages, can sort data.
Parameters Values
In the key parameter, we specify a function that is
key called on each list element before making
comparisons.
This is optional. False will sort the list in ascending
order, and true will sort the list in descending order.
reverse
Default is reverse=False.
Sort() does not return any value, but it changes from the original
list.
# Lambda functions or anonymous functions
# def add(a, b):
# return a+b
#
# # minus = lambda x, y: x-y
#
# def minus(x, y):
# return x-y
#
# print(minus(9, 4))
a =[[1, 14], [5, 6], [8,23]]
a.sort(key=lambda x:x[1])
print(a)