statisticsEasy Examples

Basic statistical functions: mean, median, mode, stdev, variance

Getting started with statistics

Basic import and usage of the statistics module.

python
import statistics

data = [2, 4, 4, 4, 5, 5, 7, 9]
print(f"Mean: {statistics.mean(data)}")
print(f"Median: {statistics.median(data)}")
print(f"Mode: {statistics.mode(data)}")
print(f"Stdev: {statistics.stdev(data):.2f}")

The statistics module is part of Python's standard library. Basic statistical functions: mean, median, mode, stdev, variance.

Common statistics operations

Frequently used functions from the statistics module.

python
# More statistics examples
import statistics

print(f"statistics module loaded successfully")
print(f"Location: {statistics.__name__}")
print(f"Has {len(dir(statistics))} attributes")

These are the most commonly used features of the statistics module.

Want to try these examples interactively?

Open Easy Playground