Mean Median Mode

# List of numbers
data = [10, 20, 20, 30, 40, 50, 50, 50]

# Calculate the mean manually
mean_manual = sum(data) / len(data)
print(f"Mean (manual calculation): {mean_manual}")
# List of numbers
data = [10, 20, 20, 30, 40, 50, 50, 50]

# Calculate the median manually
data_sorted = sorted(data)
n = len(data)
if n % 2 == 0:
    median_manual = (data_sorted[n//2 - 1] + data_sorted[n//2]) / 2
else:
    median_manual = data_sorted[n//2]

print(f"Median (manual calculation): {median_manual}")
from collections import Counter

# List of numbers
data = [10, 20, 20, 30, 40, 50, 50, 50]

# Calculate the mode manually
data_counter = Counter(data)
mode_manual = data_counter.most_common(1)[0][0]

print(f"Mode (manual calculation): {mode_manual}")