branch | scipy2010 |
changeset 436 | 7c9e949851e2 |
435:2aed1dda7909 | 436:7c9e949851e2 |
---|---|
1 |
|
2 def foo(science): |
|
3 for record in open('sslc1.txt'): |
|
4 fields = record.split(';') |
|
5 region_code = fields[0].strip() |
|
6 |
|
7 score_str = fields[6].strip() |
|
8 score = int(score_str) if score_str != 'AA' \ |
|
9 else 0 |
|
10 |
|
11 if score > 90: |
|
12 science[region_code] += 1 |
|
13 |
|
14 def bar(): |
|
15 science = {} |
|
16 science = foo(science) |
|
17 pie(science.values(), labels=science.keys()) |
|
18 savefig('science.png') |
|
19 |
|
20 if __name__ == '__main__': |
|
21 bar() |
|
22 |