Write your own function that illustrates a feature that you learned in this unit. The function must take at least one argument. The function should be your own creation
def calc_average(number):
sum_number = 0
for i in range(0, len(number), 1):
sum_number += number[i]
average = sum_number/len(number)
return average
array = [19, 4, 20, 22]
result = calc_average(array)
print("Input Array = ", array)
print("Average = " + str(result))
Comments
Leave a comment