summary refs log tree commit diff stats
path: root/python/code/05_lam_key.py
blob: 2a8dd103dd2bd0632e78abbdf68d2780591b5803 (plain) (blame)
1
2
3
4
5
6
items = [(0, 'd'), (1, 'a'), (2, 'c'), (3, 'b')]

print(max(items, key=lambda it: it[0]))
print(min(items, key=lambda it: it[1]))
items.sort(key=lambda x: ord(x[1]) - x[0])
print(items)