4 ms·
Also definitely learn about using sum on non-numbers, and the key argument to min and max. They can be incredibly handy, but I hardly see them used. Have a cont
by Doxin 5y ago
Also definitely learn about using sum on non-numbers, and the key argument to min and max. They can be incredibly handy, but I hardly see them used. Have a contrived example:
>>> max(['aaa', 'bb', 'c'], key=lambda item: len(item))
'aaa'