1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-09-19 22:16:57 +02:00
CodeWars/6kyu/split_strings/solution.py

17 lines
302 B
Python
Raw Normal View History

def solution(s):
if len(s) == 0:
return []
elif len(s) % 2 == 1:
s += "_"
arr = []
index = -1
for i, letter in enumerate(s):
if i % 2 == 0:
index += 1
arr.append(letter)
else:
arr[index] += letter
return arr