You have multiple entries of the form:
if __name__== '__main__':
// call to a function
You should remove all except one at the bottom of the file followed by calls to all the other functions in order. So:
import statistics
import numpy as np
def calc_mean(mylist):
mylist=[1, 3, 4, 5, 7, 9, 2]
x = statistics.calc_mean(mylist)
print("Mean is :", x)
def calc_harmonic_mean(mylist):
mylist=[1, 3, 5, 7, 9]
print("Harmonic Mean is % s " % (statistics.calc_harmonic_mean(mylist)))
def calc_median(mylist):
mylist = [20, 2, 7, 1, 34]
if mylist>8:
print("arr : ", mylist)
print("median of arr : ", np.calc_median(mylist))
def calc_low_median(mylist):
mylist = [1, 3, 3, 4, 5, 7]
print("Low median of the data-set is % s " % (statistics.calc_low_median(mylist)))
def calc_high_median(mylist):
mylist = [1, 3, 2, 8, 5, 4]
print("High median of the data-set is %s "% (statistics.calc_high_median(mylist)))
def calc_mean_dicts(mydict):
mydict = {"Gfg" : 4, "is" : 7, "Best" : 8, "for" : 6, "Geeks" : 10}
print("The original dictionary is : " + str(mydict))
if __name__== '__main__':
calc_mean()
calc_harmonic_mean()
calc_median()
calc_low_median()
calc_high_median()
calc_mean_dicts()
You also need to fix all the function calls to pass the required parameter that each function expects.