• 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