June 2017
Beginner to intermediate
296 pages
7h 4m
English
The code we use for sorting and displaying our results is all just straight-up Python code, there's nothing Sparkish about it:
sortedResults = collections.OrderedDict(sorted(result.items()))
for key, value in sortedResults.items():
print("%s %i" % (key, value))
All it's doing is using the collections package from Python to create an ordered dictionary that sorts those results based on the key, which is the actual rating itself. Then it iterates through every key/value pair of those results and prints them out one at a time. So the output of this bit of code is going to be this:
Rating 1 occurred twice, rating ...
Read now
Unlock full access