I don't understand why, but when I click the "check solution" button, the site shows an error, although the code works if I just run it.
def split_pairs(a):
splitted_word = list(a)
result = []
counter = 0
while True:
if len(splitted_word) == counter:
break
elif splitted_word[counter] == splitted_word[-1]:
result.append(splitted_word[counter] + '_')
break
else:
result.append(splitted_word[counter] + splitted_word[counter + 1])
counter += 2
return result
Created at: 2022/02/14 03:56; Updated at: 2022/02/14 18:05