• Split Pairs Mission

Question related to mission Split Pairs

 

Hi, I don't understand what is wrong with my code. I thought it would append every pair that I form, but somehow it only appends the last pair.

I'm sure I'm taking too many lines to do it too, but I'll learn from reading the solutions (after i manage to clear this...). Thank you!

def split_pairs(a):

if len(a)%2==0:
    None
else:
    a = a + "_"

b = list(a)
r = len(b)//2
for i in range(r):
    ans = []
    pair = b[2*i]+b[2*i+1]
    ans.append(pair)
return ans