Let's say I have a list [1,2,3,4], what I want is get the sum of the first 2 pairs and print them in this manner:
[1,2,3,4]
[3,3,4]
[6,4]
[10]
Basically, it should just keep on adding the first 2 elements of the list then delete the first 2 elements and insert the sum at the beginning until the list contains just 1 element. However I'm not able to print the same but just get this:
[1,2,3,4]
[3,3,4]
[3,4]
[3]
Here's my code for that:
counter = len(num_arr)
while (counter > 1):
    valHold = (sum(num_arr[:2]))
    del numArr[:2]
    numArr.reverse()
    numArr.append(valHold)
    numArr.reverse()
    print (numArr)
    counter -= 1
I'm really confused on what to do. Thank you very much!
 
     
     
     
     
     
     
     
    