input: from typing import List
  
  def PascalTriangle(n: int) -> List[List[int]]:
      """ Generate and print the Pascal triangle up to the given number of rows.
      >>> PascalTriangle(5)
      [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]
      >>> PascalTriangle(7)
      [[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]]
      """
      triangle = []
      
      for line in range(n):
          row = [1 if i == 0 or i == line else triangle[line-1][i-1] + triangle[line-1][i] for i in range(line + 1)]
          triangle.append(row)
      
      return triangle
  
  # Driver Code
  n = 5
  result = PascalTriangle(n)
  for line in result:
      print(line)
output:     triangle = []
      
      for line in range(n):
          row = [1 if i == 0 or i == line else triangle[line-1][i-1] + triangle[line-1][i] for i in range(line + 1)]
          triangle.append(row)
      
      return triangle