mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-19 00:37:02 +00:00
Update average_mean.py (#1293)
This commit is contained in:
parent
01bc785e84
commit
22bd6ff967
|
@ -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__":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user