- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda.py
More file actions
Latest commit
11 lines (7 loc) · 339 Bytes
/
Copy pathlambda.py
File metadata and controls
11 lines (7 loc) · 339 Bytes
1
2
3
4
5
6
7
8
9
10
11
test_list= [['Rash', 4, 28], ['Varsha', 2, 20], ['Nikhil', 1, 20], ['Akshat', 3, 21]]
# printing original list
print ("The original list is : "+str(test_list))
#lambda param: return statement
test_list.sort(key=lambdalist: list[1])
# printing result
print ("List after sorting by 2nd element of lists : "+str(test_list))