Here you will create the classic [Pascal's triangle](https://en.wikipedia.org/wiki/Pascal%27s_triangle).
Your function will be passed the depth of the triangle and you code has to return the corresponding pascal triangle up to that depth.

The triangle should be returned as a nested array.

for example:
```python
pascal(5) # should return [[1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]
```

To build the triangle, start with a single 1 at the top, for each number in the next row you just take the two numbers above it and add them together (except for the edges, which are all `1`), e.g.:
```
              [1]
            [1   1]
          [1   2   1]
        [1   3   3   1]
```

Difficulty: introductory

Starter code:

def pascal(p):
	

Solutions:
def pascal(p):
    triangle = [[1]]
    for _ in range(p - 1):
        to_sum = list(zip([0] + triangle[-1], triangle[-1] + [0]))
        triangle.append(list(map(sum, to_sum)))
    return triangle


def pascal(p):
    def create_row(n):
        row = [1]
        for k in range(n):
            row.append(row[k] * (n-k) / (k+1))
        return row
    tri = []
    for row in range(p):
        tri.append(create_row(row))
    return tri


def pascal(p):

    t = [[1]]

    for _ in range(2, p + 1):
        t.append([1] + [a + b for a, b in zip(t[-1][:-1], t[-1][1:])] + [1])

    return t

def pascal(p):
    ans = []
    for i in range(p):
        row = []
        for k in range(i + 1):
            if k == 0 or k == i:
                row.append(1)
            else:
                row.append(ans[i - 1][k - 1] + ans[i - 1][k])
            
        ans.append(row)
    return ans

from math import factorial
def pascal(p):
    return [[int((factorial(p)/(factorial(k)*factorial(p-k)))) for k in range(0,p+1)] for p in range(0,p)]

def pascal(p):
    if p == 1: return [[1]]
    output = [[1],[1,1]]
    last = [1,1]
    count = 2
    while count < p:
        new = []
        new.append(1)
        for i in range(count-1):
            new.append(last[i]+last[i+1])
        new.append(1)
        output.append(new)
        last = new
        count += 1
    return output

def pascal(p):
    row, res = [1], []
    for x in range(max(p, 0)):
        res.append(row)
        row = [l + r for l, r in zip(row + [0], [0] + row)]
    return res

def pascal(p):
    l = [[1]]
    for index in range(p-1):
        values = []
        for i,j in enumerate(l[index][:-1]):
            values.append(j+l[index][i+1])
        l.append(l[index][:1] + values + l[index][-1:])
    return l