[Solved] how would i print all the names and scores of those users from a particular class?


Updating answer based on updated question:

classdata = {}
for data in schooldata:
    if classdata.get(data['class_code']):
        classdata[data['class_code']].append(data)
    else:
        classdata[data['class_code']] = [data]   

print classdata

To print class data (in orderly manner):

for class_data in sorted(classdata):
   for person_data in sorted(classdata[class_data], key=lambda x: x['name']):
       print person_data['class_code'], person_data['name'], person_data['score']

15

solved how would i print all the names and scores of those users from a particular class?