It’s the academic year’s end, the fateful moment of your school report. The averages must be calculated. All the students come to you and entreat you to calculate their average for them. Create a python function that will return the averages of a student.

Return the average of the given array rounded down to its nearest integer.

The array will never be empty.

We will add up the total of the student scores and then find the mean of that student.

import math
def get_average(marks):
    total = 0
    mean = len(marks)
    for i in marks:
        total += i
    return math.floor(total/mean)

Now it is my turn, create a function which will take care of an empty array as well, write your answer below this post.

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *