diff --git a/maths/average.py b/maths/average.py index dc70836b5..d15601dd6 100644 --- a/maths/average.py +++ b/maths/average.py @@ -1,11 +1,10 @@ def average(nums): sum = 0 - n = 0 for x in nums: sum += x - n += 1 - avg = sum / n + avg = sum / len(nums) print(avg) + return avg def main(): average([2, 4, 6, 8, 20, 50, 70])