I want to split a list with slide of twos:
my list
A = [1,2,3,4,5,6,3,4]
desired output:
[[1,2][3,4][5,6][3,4]]
But I've tried:
def split_list(a_list):
ind1 = 0
new_list = []
for i in range(len(a_list)):
a_list = a_list[ind1:ind1+2]
new_list.append(a_list)
ind1 = ind1 + 2
return new_list