#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A module for boroughs."""

import csv
import pprint 

grades = {
    'A': float(1),
    'B': float(.9),
    'C': float(.8),
    'D': float(.7),
    'F': float(.6),
}

def get_score_summary(filename):
    fhandler = open(filename, 'r')
    reader = csv.reader(fhandler)
    data = {}
    
    for line in reader:
        camis = line[0]
        grade = line[10]
        boro = line[1]
        if grade != 'P' and grade != '':
            data[camis]=[grade, boro]
    pprint.pprint(data)
    fhandler.close()

    restsum = {}
    
    for grade in data.itervalues():
        pprint.pprint(data)
        letter = grade[0]
        boros = grade[1]
        restsum = {boros: letter}
        print restsum
        
        
  















#if __name__ == '__main__':
 #   test = get_score_summary('inspection_results.csv')

@@ -97,17 +97,16 @@
 rint
- 
 %0A%0A
-grades
+GRADES
  = %7B
@@ -122,16 +122,18 @@
  float(1
+.0
 ),%0A    '
@@ -209,13 +209,13 @@
 (.6)
-,
 %0A%7D%0A%0A
+%0A
 def 
@@ -243,16 +243,43 @@
 ename):%0A
+    %22%22%22Docstring.%0A%0A    %22%22%22%0A
     fhan
@@ -339,16 +339,63 @@
 andler)%0A
+    next(reader) #removes top line in csv file%0A
     data
@@ -395,25 +395,24 @@
    data = %7B%7D
-%0A
     %0A    for
@@ -564,17 +564,19 @@
 a%5Bcamis%5D
-=
+ = 
 %5Bgrade, 
@@ -585,32 +585,8 @@
 ro%5D%0A
-    pprint.pprint(data)%0A
     
@@ -628,22 +628,16 @@
     
-%0A    for grade
+for boro
  in 
@@ -645,12 +645,8 @@
 ata.
-iter
 valu
@@ -663,53 +663,86 @@
     
-pprint.pprint(data)%0A        letter = grade
+if boro%5B1%5D not in restsum:%0A            restsum%5Bboro%5B1%5D%5D = %5B1, GRADES%5Bboro
 %5B0%5D
+%5D%5D
 %0A   
@@ -750,80 +750,148 @@
     
-boros = grade%5B1%5D%0A        restsum = %7Bboros: letter%7D%0A        pr
+else:%0A            restsum%5Bboro%5B1%5D%5D%5B0%5D += 1%0A            restsum%5Bboro%5B1%5D%5D%5B1%5D += GRADES%5Bboro%5B0%5D%5D%0A%0A    final = %7B%7D%0A    for boro, grade 
 in
-t
  restsum
 %0A   
@@ -890,46 +890,97 @@
 tsum
-%0A        %0A        %0A  %0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A#
+.iteritems():%0A        final%5Bboro%5D = (grade%5B0%5D, grade%5B1%5D / grade%5B0%5D)%0A    return final%0A%0A%0A%0A%0A
 if _
@@ -1003,17 +1003,16 @@
 in__':%0A 
-#
    test 

task 1