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: 2019/04/22 20:56; Updated at: 2019/04/23 18:39
The question is resolved.