Skip to content

Commit 5399509

Browse files
committed
Merge branch 'improveMeanCalc'
2 parents 7f8486b + 3a4dda9 commit 5399509

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

average.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import numpy as np
22
def mean(array):
3-
count=0
4-
sum = 0
5-
for x in array:
6-
sum = sum + x
7-
count = count + 1
8-
return float(sum)/float(count)
3+
return np.mean(array)
94
def main():
105
data = np.array([1.0, 2.0, 3.0, 4.0])
116
ave = mean(data)

0 commit comments

Comments
 (0)