Python/maths/average_mean.py
PatOnTheBack add1aef064 Rename average.py to average_mean.py (#939)
'average.py' is ambiguous. There are several kinds of averages, so 'average_mean.py' is a more precise name.
2019-07-10 07:21:04 +02:00

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()