Title: any(), all(), max(), min(), sum()
Slug: any_all_max_min_sum
Summary: any(), all(), max(), min(), sum() in Python.
Date: 2016-01-23 12:00
Category: Python
Tags: Basics
Authors: Chris Albon
Interesting in learning more? Check out Fluent Python
In [1]:
data = [34, 54, 50, 20, 20]
In [2]:
# Return true if any element is True
any(data)
Out[2]:
In [3]:
# Return true if all elements are True
all(data)
Out[3]:
In [4]:
# Return max value
max(data)
Out[4]:
In [5]:
# Return the min value
min(data)
Out[5]:
In [6]:
# Return the total value
sum(data)
Out[6]: