Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Straight forward solution in Clear category for The Most Wanted Letter by Dragonfly555
def checkio(text):
text = text.lower()
tempbest = 0
for char in text:
if char.isalpha():
if text.count(char) > tempbest:
tempbest = text.count(char)
letter = char
elif text.count(char) == tempbest:
if ord(char) < ord(letter): letter = char
return letter
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio("Hello World!") == "l", "Hello test"
assert checkio("How do you do?") == "o", "O is most wanted"
assert checkio("One") == "e", "All letter only once."
July 20, 2015