• Not sure how to return the first letter.

Question related to mission The Most Wanted Letter

 

Also, for the 'Aaaooo!!!!' test, it is working properly in the 'try it' section but not in the 'check and run' section.

def checkio(text):
    text = text.lower()
    mwl = {}
    for letter in text:
        if letter not in mwl:
            mwl[letter] = 1
        else:
            mwl[letter] += 1

    for letter in sorted(mwl, key = mwl.get, reverse = True):
        if letter.isalpha():
            letter = sorted(list(letter))
            return letter[0]