pythonでのmaxの使い方
621 ワード
max
max(...)
1:
2:
3:
max(...)
max(iterable, *[, default=obj, key=func]) -> value
max(arg1, arg2, *args, *[, key=func]) -> value
With a single iterable argument, return its biggest item. The
default keyword-only argument specifies an object to return if
the provided iterable is empty.
With two or more arguments, return the largest argument.
1:
>>> max(1,2,3,4,5)
5
2:
>>> max([1,2,3],[4],[5,6],key=lambda x:len(x))
[1, 2, 3]
3:
>>> max([],default="empty")
'empty'