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