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
| Name | Type | Description |
|---|---|---|
| data | iterable of numbers | Observations 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]))