Light Mode
Dark Mode
The task doesn't want to be solved

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
Attachment
Created: Feb. 14, 2022, 3:56 a.m.
Updated: Feb. 14, 2022, 6:05 p.m.
0
10
User avatar
Danya404