blob: 110a924ed1db0576e3704baac79c7e0077869377 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
math_scores = []
for record in open('sslc1.txt'):
fields = record.split(';')
math_score = fields[5].strip()
if math_score != 'AA':
math_scores.append(int(math_score))
else:
math_scores.append(0)
# List method
print "Mean: ", mean(math_scores)
print "Median: ", median(math_scores)
print "Standard Deviation: ", std(math_scores)
# Array method
math_scores = array(math_scores)
print "Mean: ", mean(math_scores)
print "Median: ", median(math_scores)
print "Standard Deviation: ", std(math_scores)
|