In my editor, the code runs fine and passes all the assertion checks. When I try to do it in checkio's editor, it runs veeeeeery slowly, before giving me an error. The example it fails on is checkio("aaaaaaaaaaaaa") with many more a's. I'm unable to replicate the error on my end. Any ideas?
def checkio(text: str) -> str:
t2 = text.lower()
v2 = []
numbers = []
l1 = []
for letter in t2:
if letter.isalpha() == False:
continue
else:
number = ord(letter) - 96
numbers.append(number)
for i in t2:
if i.isalpha():
v2.append(t2.count(i))
v1 = t2[v2.index(max(v2))]
if v2.count(max(v2))>1:
for n in numbers:
if numbers.count(n) ==max(v2) and n not in l1:
l1.append(n)
n1 = min(l1)
v1 = chr(n1+96)
elif max(v2) == min(v2):
v1 = chr(min(numbers)+96)
return v1
Created at: 2020/03/07 22:20; Updated at: 2020/03/08 21:19
The question is resolved.