Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The Most Wanted Letter by carlos.g.prado
import string
from collections import defaultdict
def checkio(text):
d = defaultdict(int)
for c in text:
if c not in string.ascii_letters:
continue
if c.isupper():
c = c.lower()
d[c] += 1
# Sort the dictionary by value
# This returns a list of keys
sd = sorted(d, key = lambda x: d[x], reverse = True)
highest = [x for x in sd if d[x] == d[sd[0]]]
return sorted(highest)[0]
Oct. 11, 2015
Comments: