def split_pairs(a):
? ? # your code here
? ? import re
? ? s=str(a)
? ? if len(s)==0:
? ? ? ? return []
? ? elif int(len(s)) % 2 ==0:
? ? ? ? c=s.strip()
? ? ? ? mm=re.findall(r'.{2}', c)
? ? ? ? return mm
? ? else:
? ? ? ? c=s+'_'
? ? ? ? mm=re.findall('.{'+str(2)+'}', c)
? ? ? ? return mm
if __name__ == '__main__':
? ? print("Example:")
? ? print(list(split_pairs('abcd')))
? ? # These "asserts" are used for self-checking and not for an auto-testing
? ? assert list(split_pairs('abcd')) == ['ab', 'cd']
? ? assert list(split_pairs('abc')) == ['ab', 'c_']
? ? assert list(split_pairs('abcdf')) == ['ab', 'cd', 'f_']
? ? assert list(split_pairs('a')) == ['a_']
? ? assert list(split_pairs('')) == []
? ? print("Coding complete? Click 'Check' to earn cool rewards!")