input: Write a python function to generate Pascal's triangle up to the nth row.
  assert generate_pascals_triangle(5) == [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]
  assert generate_pascals_triangle(3) == [[1], [1, 1], [1, 2, 1]]
  assert generate_pascals_triangle(1) == [[1]]
output: def generate_pascals_triangle(n):
      triangle = []
      for i in range(n):
          row = [1] * (i + 1)
          for j in range(1, i):
              row[j] = triangle[i-1][j-1] + triangle[i-1][j]
          triangle.append(row)
      return triangle