dgadiraju
1/4/2018 - 5:31 AM

GetCountOfEngineeringStudents.py

kgislData = open("C:\\kgisl.csv").read().splitlines()
countByDegree = {}
for i in kgislData:
    degree = "Engineering" if(i.split("\t")[3]
                              in ["CSE", "IT", "ECE"]) \
        else "Non Engineering"
    if(countByDegree.has_key(degree)):
        countByDegree[degree] = countByDegree[degree] + 1
    else:
        countByDegree[degree] = 1 #{"CSE" : 1}

for i in countByDegree:
    print(i + "\t" + str(countByDegree[i]))