Answer to Question #331055 in Python for Labtec

Question #331055

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


1
Expert's answer
2022-04-19T15:27:55-0400
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))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS