I have a list like the following:
original_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
And my desired output is:
result = [['a', 'b'], ['c', 'd'], ['e', 'f'], ['g']]
Here, the items of 'result' will be each one list of two items from the original_list. so if the total no of items in original_list is 8 then it will give like the following:
original_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
And my desired output is:
result = [['a', 'b'], ['c', 'd'], ['e', 'f'], ['g', 'h']]
I tried to solve that using 2 dimensional matrix but its not working as the elements of the original_list is sometimes even and odd.
any suggestion how can i follow?