• The task doesn't want to be solved

Question related to mission Split Pairs


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:
    elif splitted_word[counter] == splitted_word[-1]:
        result.append(splitted_word[counter] + '_')
        result.append(splitted_word[counter] + splitted_word[counter + 1])
        counter += 2
return result