Skip to content

Commit

Permalink
Update average_mean.py (TheAlgorithms#1293)
Browse files Browse the repository at this point in the history
  • Loading branch information
maramsumanth authored and cclauss committed Oct 7, 2019
1 parent 01bc785 commit 22bd6ff
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions maths/average_mean.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@

def average(nums):
"""Find mean of a list of numbers."""
sum = 0
for x in nums:
sum += x
avg = sum / len(nums)
print(avg)
avg = sum(nums) / len(nums)
return avg


def main():
"""Call average module to find mean of a specific list of numbers."""
average([2, 4, 6, 8, 20, 50, 70])
print(average([2, 4, 6, 8, 20, 50, 70]))


if __name__ == "__main__":
Expand Down

0 comments on commit 22bd6ff

Please sign in to comment.