circulate/sslc_allreg.py
author Puneeth Chaganti <punchagan@gmail.com>
Sat, 01 May 2010 16:16:39 +0530
changeset 395 e886e37a5032
parent 385 c70118cdde66
permissions -rwxr-xr-x
Added program anagrams.py.
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