Lab 1: Descriptive Statistics – Mean, Median, Mode, Variance, Std. Dev.

CILO: 1
Weeks: 6–7
Lab #1

Aim

Compute and interpret mean, median, mode, variance and standard deviation for a numeric list.

Objectives

Algorithm / Procedure

  1. Input a list of numbers.
  2. Sort the list for the median and mode logic.
  3. Compute mean (sum / n).
  4. Compute median (middle after sorting) and mode (most frequent).
  5. Compute population variance and standard deviation (√variance).
  6. Print and interpret values.

Python Code

import statistics as stats
import numpy as np

data = [5, 7, 3, 7, 9, 10, 7, 5, 9, 10]

mean = np.mean(data)
median = np.median(data)
mode = stats.mode(data)
variance = np.var(data)      # population variance
std_dev = np.std(data)       # population std

print("Data:", data)
print("Mean:", mean)
print("Median:", median)
print("Mode:", mode)
print("Variance:", variance)
print("Standard Deviation:", std_dev)

Sample Output (expected)

Data: [5, 7, 3, 7, 9, 10, 7, 5, 9, 10]
Mean: 7.2
Median: 7.0
Mode: 7
Variance: 5.56
Standard Deviation: 2.36