0% found this document useful (0 votes)
8 views2 pages

IML Program 1

The program calculates central tendency measures (mean, median, mode) and dispersion measures (variance, standard deviation) for a given dataset. The output shows a mean and median of 15.0, a mode of 12, a variance of approximately 7.74, and a standard deviation of about 2.78. The calculations are performed using NumPy and statistics libraries in Python.

Uploaded by

logitech9966
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

IML Program 1

The program calculates central tendency measures (mean, median, mode) and dispersion measures (variance, standard deviation) for a given dataset. The output shows a mean and median of 15.0, a mode of 12, a variance of approximately 7.74, and a standard deviation of about 2.78. The calculations are performed using NumPy and statistics libraries in Python.

Uploaded by

logitech9966
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PROGRAM:

import numpy as np
import statistics as stats

# Example data
data = [12, 15, 11, 18, 14, 16, 12, 19, 20, 15, 14, 16]

# Central Tendency Measures:


mean = np.mean(data) # Mean
median = np.median(data) # Median
mode = stats.mode(data) # Mode

# Dispersion Measures:
variance = np.var(data) # Variance
std_dev = np.std(data) # Standard Deviation

# Output results
print(f"Mean: {mean}")
print(f"Median: {median}")
print(f"Mode: {mode}")
print(f"Variance: {variance}")
print(f"Standard Deviation: {std_dev}")

OUTPUT:
Mean: 15.0
Median: 15.0
Mode: 12
Variance: 7.736363636363637
Standard Deviation: 2.7827450531799757

You might also like