Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Most Wanted Letter solution in Clear category for The Most Wanted Letter by JohanL
import string
from collections import Counter
import operator
def checkio(text: str) -> str:
# Filter to get only ascii letters (as lower case):
text = (ch for ch in text.lower() if ch in string.ascii_lowercase)
# Find frequencies and order alphabetically (as tuples9
# This ensures that max will find the correct max value
freq = sorted(Counter(text).items())
# Find the tuple with the max frequency
most = max(freq, key=operator.itemgetter(1))
# Return the letter from the max tuple
return most[0]
Nov. 20, 2018
Comments: