• most wanted letter


The code below creates the dictionary, but the sorted function doesn't seem to be doing anything. I guess I'm not sure how to get the output for the return (just returning 0 for testing)... would I see the dictionary in order if I print it as below? Thanks for the help.

def checkio(text):

letters = list(text)
cntDict = {}

for letter in letters:
    if letter.isalpha():
        letter = letter.lower()
        if letter not in cntDict:
            cntDict[letter] = 1

            cntDict[letter] += 1

sorted(cntDict.items(), key=lambda x: x[1], reverse=True)


return 0