Having trouble with this. It keeps stating that my string index is out of range and I dunno how to fix that.
def checkio(text: str) -> str:
#replace this for solution
alphabet = 'abcdefghijklmnopqrstuvwxyz'
text = text.lower()
dct = {}
for letter in text:
if letter in alphabet:
number = text.count(letter)
dct[letter] = number
maximum = sorted(dct, key=lambda x:(x[1], -x[0]))
return maximum[0][0]
Created at: April 22, 2019, 8:56 p.m.; Updated at: April 23, 2019, 6:39 p.m.
The question is resolved.