什麼是在域[定量]的數字範圍(198)和(272)包括需要幫助的在Python
quant
95
189
176
200
177
340
205
203
284
88
109
83
360
67
250
56
111
439
354
143
的平均價值發現AVERAGE是我試過的代碼。以上是我需要查找平均值的[quant]字段。
word_file = open('300000a.csv','r')
firstLine = True
for line in word_file:
if firstLine:
firstLine = False
continue
line = line.strip()
line = line.split (",")
field = int(line[0])
TotalMetalCount +=1
if field >198 or field <272:
metalCounts += 1
else:
metalCounts = 1
countT +=1
if field >198 or field <272:
count += 1
['reduce(lambda x,y:x + y,l)/ len(l)'](http://stackoverflow.com/questions/9039961/finding-the-average-of-a-list) – 2013-05-14 12:23:02
@GrijeshChauhan請不要建議'減少',當你可以只使用'sum' – jamylak 2013-05-14 12:25:18
@jamylak :) :) ..同意,謝謝! :) – 2013-05-14 12:26:55