Fails the All letter only once check
My Main issue is that sorted isn't taking count,key=lambda letter: -letter[1], letter[0] Its saying that positional can't come after the keyword argument but I thought -letter[1] jsut reverses and the second one was supposed to be its index?
def checkio(text: str) -> str: #replace this for solution text = text.lower() count = [] for letter in list(text): if letter.isalpha(): count.append((letter,text.count(letter))) most = sorted(count, key=lambda letter: -letter[1],letter[0]) return most[0][0]
if name == 'main': print("Example:") print(checkio("Hello World!"))
#These "asserts" using only for self-checking and not necessary for auto-testing assert checkio("Hello World!") == "l", "Hello test" assert checkio("How do you do?") == "o", "O is most wanted" assert checkio("One") == "e", "All letter only once." assert checkio("Oops!") == "o", "Don't forget about lower case." assert checkio("AAaooo!!!!") == "a", "Only letters." assert checkio("abe") == "a", "The First." print("Start the long test") assert checkio("a" * 9000 + "b" * 1000) == "a", "Long." print("The local tests are done.")