input: Write a python function to generate Pascal's Triangle up to the nth row.
  assert pascal_triangle(1) == [[1]]
  assert pascal_triangle(3) == [[1], [1, 1], [1, 2, 1]]
  assert pascal_triangle(5) == [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]
  assert pascal_triangle(8) == [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], [1, 5, 10, 10, 5, 1], [1, 6, 15, 20, 15, 6, 1], [1, 7, 21, 35, 35, 21, 7, 1]]
output: def pascal_triangle(n):
      triangle = []
      for i in range(n):
          if i == 0:
              triangle.append([1])
          else:
              row = [1]
              for j in range(1, i):
                  row.append(triangle[i-1][j-1] + triangle[i-1][j])
              row.append(1)
              triangle.append(row)
      return triangle