circulate/sslc_science.py
changeset 365 2cda9b04f142
parent 359 cb17c87b090e
child 385 c70118cdde66
equal deleted inserted replaced
364:856470d9a952 365:2cda9b04f142
       
     1 science = {}
       
     2 
       
     3 for record in open('sslc1.txt'):
       
     4 #    record = record.strip()
       
     5     fields = record.split(';')
       
     6 
       
     7     region_code = fields[0].strip()
       
     8 
       
     9     if region_code not in science:
       
    10         science[region_code] = 0
       
    11 
       
    12     score_str = fields[6].strip()
       
    13 
       
    14     score = int(score_str) if score_str != 'AA' else 0
       
    15 
       
    16     if score > 90:
       
    17         science[region_code] += 1
       
    18 
       
    19 figure(1)
       
    20 pie(science.values(), labels=science.keys())
       
    21 title('Students scoring 90% and above in science by region')
       
    22 savefig('science.png')