Python Mean and Standard Deviation
mean / std Practice

Center and spread in two numbers

mean is the average. std measures how far values typically sit from that average.

Picture this: summarize the grid

mean = typical value. std = how spread out.

arraydata
→
np.meancenter
→
np.stdspread
→
two numbersstats

In easy words

Mean answers “what is typical?”. Standard deviation answers “how spread out?”. Together they summarize a numeric list quickly.

Where this shows up

Exam score reports, sensor noise checks, feature scaling (normalize by mean/std), quality control.

Key facts

  • mean — arr.mean() = sum / count.
  • std — arr.std() = spread around the mean.
  • Round — Use round(x, 2) for readable output.
  • Population default — NumPy std uses ddof=0 by default.

What to remember

  • Target — [1,2,3,4,5] → mean 3.0, std ≈ 1.41.
  • Order — Print mean then std.
  • Why both — Same mean can hide very different spreads.
  • Watch floats — Rounding avoids long decimals.
Interactive visualizer

Distribution summary

mean—
std (2 dp)—
Ready

Example Program

1import numpy as np
2arr = np.array([1, 2, 3, 4, 5])
3print(round(arr.mean(), 2), round(arr.std(), 2))