python order 2d array by secode element

sorted(arr, key=lambda x: x[1])

Here is what the above code is Doing:
1. We’re using the sorted function to sort the list of tuples.
2. We’re using the key parameter to specify a function that will be used to sort the list.
3. The function we’re using is a lambda function.
4. The lambda function takes a tuple as an input and returns the value at index 1.
5. This means that the sorted function will sort the list of tuples based on the value at index 1.