import statistics
import numpy as np
import pandas as pd

x = [8, 1, 2, 4, 60]
#x = [8.0, 1, 2.5, 4, 28.0]

y=np.array(x)
z=pd.Series(x)

################ Mean #################################

# using pure Python
mean=sum(x)/len(x)
print("Mean using pure Python: ", mean)
print()

# using built-in Python statistics functions

mean1 = statistics.mean(x)
mean2 = statistics.fmean(x) #alternative function for 
#the calculation of mean. Note: It always returns a floating-point number 

print("Mean1: ", mean1)
print("Mean2: ", mean2)
print()

#using numpy functions
mean1 = np.mean(y)
print("Using np.mean() the variable Mean1 equals to: ", mean1)

#using corresponding method of a np.array
mean1 = y.mean()
print("Using method .mean() the variable Mean1 equals to: ", mean1)

#using method .mean() for pd.Series objects

mean1 = z.mean()
print("Using method .mean() of pd.Series objects the variable Mean1 equals to: ", mean1)


