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): def average(nums):
"""Find mean of a list of numbers.""" """Find mean of a list of numbers."""
sum = 0 avg = sum(nums) / len(nums)
for x in nums:
sum += x
avg = sum / len(nums)
print(avg)
return avg return avg
def main(): def main():
"""Call average module to find mean of a specific list of numbers.""" """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__": if __name__ == "__main__":