Histogram and box.
Goal
Run every block and look at the Plot panel.
rng = np.random.default_rng(0)
units = rng.integers(1, 20, size=80)
plt.hist(units, bins=8, color="#1d4f7a")
plt.title("Units distribution")
plt.show()rng = np.random.default_rng(0)
nairobi = rng.integers(8, 22, size=40)
mombasa = rng.integers(2, 16, size=40)
plt.boxplot([nairobi, mombasa], tick_labels=["Nairobi", "Mombasa"])
plt.title("Units by city")
plt.show()rng = np.random.default_rng(1)
plt.hist(rng.normal(12, 3, 120), bins=12)
plt.title("A smoother sample")
plt.show()print("A histogram answers 'how often'. A box answers 'typical + spread'.")Pitfall
Always plt.show(). Paste the whole editor.