Skip to content

Commit 22bd6ff

Browse files
maramsumanthcclauss
authored andcommitted
Update average_mean.py (TheAlgorithms#1293)
1 parent 01bc785 commit 22bd6ff

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

maths/average_mean.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33

44
def average(nums):
55
"""Find mean of a list of numbers."""
6-
sum = 0
7-
for x in nums:
8-
sum += x
9-
avg = sum / len(nums)
10-
print(avg)
6+
avg = sum(nums) / len(nums)
117
return avg
128

139

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

1814

1915
if __name__ == "__main__":

0 commit comments

Comments
 (0)