Light Mode
Dark Mode
Feedback from user sandarovich
Hello. Please check test 5 in Excercise most-wanted-letter. Correct answer is 'o', not 'a'.

Thanks in advance.

 Your result: "o"
Right result: "a"
Input
"AAaooo!!!!"

letters of text is checked with condition
char.isalpha() and char.islower():

My code:

def checkio(text):
    res ={}
    for char in text:
        if char.isalpha() and char.islower():
            try:
                res[char] +=1
            except KeyError:
                res[char] = 1
    res = list(res.items())
    res.sort(key=lambda k: ( -k[1],k[0]))
    return res[0][0]

URL from: http://www.checkio.org/mission/most-wanted-letter/solve/
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1; rv:28.0) Gecko/20100101 Firefox/28.0
  • feedback
Created: May 15, 2014, 2:53 p.m.
Updated: May 15, 2014, 9:38 p.m.
1
9
User avatar
sandarovich