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