Skip to main content

Interview problem of Ant Fin

Project description

afivmax

Build Status PyPI version Coverage Status Documentation Status

安装

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for afivmax, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size afivmax-0.3.0.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page