All,
I'm having difficulty sorting a dictionary by value and then printing.
My object (dataSet) looks like the following...
dict_items([(0, {'studentName': 'dan', 'Score': 80.0}), (1, {'studentName': 'rob', 'Score': 92.0})]) I would like to sort by Score and print, but I am failing miserably. I used the following method as advised to sort by StudentName, if it is of help.
entries = sorted([(dataSet[entry]['studentName'], dataSet[entry]['Score']) for entry in dataSet]) for name, score in entries: print(('Student: {} -- Score: {}%'.format(name, score)))