Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get mean using python

# --------------------- MEAN ---------------------

# Dataset for questions -
dataset = [2, 1, 1, 4, 5, 8, 12, 4, 3, 8, 21, 1, 18, 5]

# Finding sum of dataset
sumOfDataset = sum(dataset)

# Finding length of dataset
lenOfDataset = len(dataset)

# Calculating the mean by dividing the sum of dataset with the length of dataset
mean = sumOfDataset / lenOfDataset

# Printing the mean of dataset
print(mean)
Source by nbviewer.org #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
1+8 =