mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 09:10:16 +00:00
add1aef064
'average.py' is ambiguous. There are several kinds of averages, so 'average_mean.py' is a more precise name.
21 lines
371 B
Python
21 lines
371 B
Python
"""Find mean of a list of numbers."""
|
|
|
|
|
|
def average(nums):
|
|
"""Find mean of a list of numbers."""
|
|
sum = 0
|
|
for x in nums:
|
|
sum += x
|
|
avg = sum / len(nums)
|
|
print(avg)
|
|
return avg
|
|
|
|
|
|
def main():
|
|
"""Call average module to find mean of a specific list of numbers."""
|
|
average([2, 4, 6, 8, 20, 50, 70])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|