Statistics Functions

statistics.mean()

Compute the arithmetic mean of nonempty numeric data. Homogeneous Decimal or Fraction inputs retain their arithmetic semantics; do not assume mixed-type support.

Formal Syntax & Structure

python syntaxpython
statistics.mean(data)

Parameters & Attributes

NameTypeDescription
dataiterable of numbersObservations used by the statistic.

Return Value

number

Numeric result; concrete type depends on inputs.

Working Example

Example Snippetpython
import statisticsprint(statistics.mean([4, 8, 12]))
Python Reference