def pascals_triangle(n):
    """The first n rows of pascal's triangle"""
    out = [[1]]
    L = [1]
    for i in range(1,n):
        t = [0] + L
        for i in range(len(L)):
            t[i] += L[i]
        L = t
        out.append(L)
    return out