You are given a list/array which contains only integers (positive and negative). Your job is to sum only the numbers that are the same and consecutive. The result should be one list.

Extra credit if you solve it in one line. You can assume there is never an empty list/array and there will always be an integer. 

Same meaning: 1 == 1

1 != -1

#Examples:

```
[1,4,4,4,0,4,3,3,1] # should return [1,12,0,4,6,1]

"""So as you can see sum of consecutives 1 is 1 
sum of 3 consecutives 4 is 12 
sum of 0... and sum of 2 
consecutives 3 is 6 ..."""

[1,1,7,7,3] # should return [2,14,3]
[-5,-5,7,7,12,0] # should return [-10,14,12,0]
```

Difficulty: introductory

Starter code:

def sum_consecutives(s):
	

Solutions:
from itertools import groupby

def sum_consecutives(s):
    return [sum(group) for c, group in groupby(s)]

def sum_consecutives(s):
    prev = None
    x = []
    for i in s:
        if i == prev:
            x[-1] += i
        else:
            x.append(i)
        prev = i
    return x

from itertools import groupby


def sum_consecutives(nums):
    return [sum(g) for _, g in groupby(nums)]


def sum_consecutives(s):
    n,a = [s[0]],s[0]
    for i in range(1,len(s)):
        if s[i] != a:
            n.append(s[i])
            a = s[i]
        elif s[i] == a:
            n[-1] += a
    return n

def sum_consecutives(s):
    res = []
    last = None
    for n in s:
        if n != last:
            res.append(n)
            last = n
        else:
            res[-1] += n
    return res

from itertools import groupby

def sum_consecutives(s):
    return [sum(grp) for _, grp in groupby(s)]

from itertools import groupby

def sum_consecutives(xs):
    return [sum(g) for _, g in groupby(xs)]

def sum_consecutives(s, i=0):
    ret , s = [], s+['']
    while i<len(s)-1:
        x = sims(s, i, s[i])
        ret.append(x[0])
        i = x[1]
    return ret 
    
def sims(arr,i, sm):
    while arr[i] == arr[i+1]:
        i += 1
        sm += arr[i]
    return sm, i+1


from itertools import groupby


def sum_consecutives(lst):
    return [sum(g) for _, g in groupby(lst)]

import itertools

def sum_consecutives(s):
    return [sum(num) for g, num in itertools.groupby(s)]