Make a function **"add"** that will be able to sum elements of **list** continuously and return a new list of sums.

For example: 

```
add [1,2,3,4,5] == [1, 3, 6, 10, 15], because it's calculated like 
this : [1, 1 + 2, 1 + 2 + 3, 1 + 2 + 3 + 4, 1 + 2 + 3 + 4 + 5]
```

If you want to learn more see https://en.wikipedia.org/wiki/Prefix_sum

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def add(l):
	

Solutions:
from itertools import accumulate

def add(l):
	return list(accumulate(l)) if isinstance(l, list) and all((isinstance(x, int) for x in l)) else 'Invalid input'


from itertools import accumulate

def add(lst):
	return list(accumulate(lst))


from itertools import accumulate

def add(a):
	return isinstance(a, list) and all((isinstance(x, int) for x in a)) and [*accumulate(a)] or 'Invalid input'


def add(l):
	return [sum(l[:i + 1]) for i in range(0, len(l))] if all((isinstance(x, int) for x in l)) and isinstance(l, list) else 'Invalid input'


def add(l):
	return [sum(l[:i + 1]) for i in range(len(l))]


add = lambda L: [sum(L[:i]) for i in range(1, len(L) + 1)]


def add(lst):
	if not isinstance(lst, list):
		return 'Invalid input'
	(total, result) = (0, [])
	for n in lst:
		if not isinstance(n, int):
			return 'Invalid input'
		total += n
		result.append(total)
	return result


from itertools import accumulate

def add(l):
	return list(accumulate(l))


add = lambda l: 'Invalid input' if any((type(e) != int for e in l)) or type(l) != list else [sum(l[:i + 1]) for i in range(len(l))]


def add(l):
	try:
		t = [l[0]]
		for (i, j) in enumerate(l[1:]):
			t.append(t[i] + j)
		if sum(l) % 1 != 0 or sum(t) % 1 != 0 or type(l) != list:
			return 'Invalid input'
		return t
	except:
		return 'Invalid input'