circulate/sslc_allreg.py
author Christopher Burns <chris.d.burns@gmail.com>
Sun, 27 Jun 2010 15:16:54 -0500
branchscipy2010
changeset 423 11c942a85b3f
parent 385 c70118cdde66
permissions -rwxr-xr-x
REF: Reformat some of the if-blocks so it's a little more clear.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     2
math_scores = []
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
for record in open('sslc1.txt'):
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
    fields = record.split(';')
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     6
    math_score = fields[5].strip()
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     7
    if math_score != 'AA':
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     8
        math_scores.append(int(math_score))
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     9
    else:
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    10
        math_scores.append(0)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    13
# List method
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    14
print "Mean: ", mean(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    16
print "Median: ", median(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    18
print "Standard Deviation: ", std(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
# Array method
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    22
math_scores = array(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    24
print "Mean: ", mean(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    26
print "Median: ", median(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    28
print "Standard Deviation: ", std(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29