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

Create Data


In [1]:
data = [34, 54, 50, 20, 20]

any()


In [2]:
# Return true if any element is True
any(data)


Out[2]:
True

all()


In [3]:
# Return true if all elements are True
all(data)


Out[3]:
True

max()


In [4]:
# Return max value
max(data)


Out[4]:
54

min()


In [5]:
# Return the min value
min(data)


Out[5]:
20

sum()


In [6]:
# Return the total value
sum(data)


Out[6]:
178