Interview problem of Ant Fin
Project description
afivmax
安装
pip install afivmax
使用
from afivmax.afivmax import afiv_max
# args
assert 3 == afiv_max(1, 2, 3)
assert 3 == afiv_max(3, 3, 3)
# args with key
assert 3 ==afiv_max(1, 2, 3, key=lambda x: x ** 2)
class TmpClass:
def __init__(self, x):
self.val = x
assert 9 == afiv_max(*[TmpClass(x) for x in range(10)], key=lambda x: x.val).val
# iterables
assert 3 == afiv_max([1, 2, 3])
assert 3 == afiv_max([3, 2, 1])
assert 3 == afiv_max([3])
# iterables with keys
assert 3 == afiv_max([1, 2, 3], key=lambda x: x ** 2)
assert 9 == afiv_max([TmpClass(x) for x in range(10)], key=lambda x: x.val).val
# iterables with default
assert 10 == afiv_max([], default=10), "iterable with default only"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
afivmax-0.3.0.tar.gz
(2.8 kB
view hashes)