diff options
author | Puneeth Chaganti | 2010-04-13 14:32:38 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2010-04-13 14:32:38 +0530 |
commit | 00278f3b0956f1404f9d8877c7ae5a2f9b963a35 (patch) | |
tree | aa62b2fad38f286e3ccc3b78d7ef3272f9247d9e /statistics.txt | |
parent | 7df23fda4d6cfb8c1aea249d99f0678d4ad54e1a (diff) | |
download | st-scripts-00278f3b0956f1404f9d8877c7ae5a2f9b963a35.tar.gz st-scripts-00278f3b0956f1404f9d8877c7ae5a2f9b963a35.tar.bz2 st-scripts-00278f3b0956f1404f9d8877c7ae5a2f9b963a35.zip |
More edits to statistics.txt.
Diffstat (limited to 'statistics.txt')
-rw-r--r-- | statistics.txt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/statistics.txt b/statistics.txt index 2d57667..54e04d6 100644 --- a/statistics.txt +++ b/statistics.txt @@ -119,11 +119,11 @@ Let's now start off with the code We first create an empty dictionary science = {} -now we read the record data one by one from the file sslc.txt +now we read the records, one by one from the file sslc.txt for record in open('sslc.txt'): - we split the record on ';' and store them in a list by: fields equals record.split(';') + we split each record on ';' and store it in a list by: fields equals record.split(';') now we get the region code of a particular entry by region_code equal to fields[0].strip. The strip() is used to remove all leading and trailing white spaces from a given string @@ -135,7 +135,7 @@ The strip() is used to remove all leading and trailing white spaces from a given Note that this if statement is inside the for loop so for the if block we will have to give additional indentation. - we again come back to the older 'for' loop indentation and we again strip the string and to get the science marks by + we again come back to the older, 'for' loop's, indentation and get the science marks by score_str = fields[6].strip() we check if student was not absent @@ -161,3 +161,4 @@ title('Students scoring 90% and above in science by region') savefig('science.png') That brings us to the end of this tutorial. We have learnt about dictionaries, some basic string parsing and plotting pie chart in this tutorial. Hope you have enjoyed it. Thank you. +#slide of summary. |