« first day (115 days earlier)      last day (845 days later) » 

14:42
For algo-class we have to come up with a linear time implementation to find the mode
They import: from operator import itemgetter
Something tells me someone at Udacity Googled the solution
37
A: Getting key with maximum value in dictionary?

unbeknownYou can use operator.itemgetter for that: import operator stats = {'a':1000, 'b':3000, 'c': 100} max(stats.iteritems(), key=operator.itemgetter(1))[0] And instead of building a new list in memory use stats.iteritems(). The key parameter to the max() function is a function that computes a key t...


« first day (115 days earlier)      last day (845 days later) »