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 solnischka78
def checkio(text: str) -> str:
text = text.lower()
letters = {char: text.count(char) for char in set(text) if char.isalpha()}
freq = max(letters.values())
let = min(k for k, v in letters.items() if v == freq)
return str(let)
print("Example:")
print(checkio("Hello World!"))
# These "asserts" are used for self-checking
assert checkio("Hello World!") == "l"
assert checkio("How do you do?") == "o"
assert checkio("One") == "e"
assert checkio("Oops!") == "o"
assert checkio("AAaooo!!!!") == "a"
assert checkio("abe") == "a"
print("The mission is done! Click 'Check Solution' to earn rewards!")
April 12, 2024
Comments: