input: from typing import List
  
  def pascal_triangle(n: int) -> List[List[int]]:
      """Given a number of rows (n), this function generates and prints Pascal's 
      triangle up to n rows. Each row in the triangle is represented as a list of 
      integers.
      >>> pascal_triangle(5)
      [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]
      """
output:     if n <= 0:
          return []
  
      triangle = [[1]]
  
      for i in range(1, n):
          prev_row = triangle[-1]
          new_row = [1]
          for j in range(1, i):
              new_row.append(prev_row[j-1] + prev_row[j])
          new_row.append(1)
          triangle.append(new_row)
  
      return triangle