daco2020 2022. 4. 15. 23:33

Description:

It's the academic year's end, 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. Easy ! You just need to write a script.

 

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

The array will never be empty.

 

 

 

Solution:

1. Find the average.
2. Rounds down to an integer and returns it.

 

 

def get_average(marks):
    import statistics
    return statistics.mean(marks)//1

There are several ways to discard the decimal point. Among them, the simplest way to round off is to divide by 1 to get an integer value.

Although this method is not well introduced in the blog, it is a very simple and practical method.