Update average_mean.py (#1293)

This commit is contained in:
Maram Sumanth 2019-10-07 23:56:40 +05:30 committed by Christian Clauss
parent 01bc785e84
commit 22bd6ff967

View File

@ -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__":