input: from typing import List
  
  def PascalTriangle(n: int) -> List[List[int]]:
      """ Generate and print Pascal's Triangle up to n rows.
      >>> PascalTriangle(5)
      1 
      1 1 
      1 2 1 
      1 3 3 1 
      1 4 6 4 1 
      """
      arr = [0 for i in range(n)] 
      result = []
  
      for line in range(0, n): 
          row = []
          for i in range(0, line + 1): 
              if (i == 0 or i == line): 
                  arr[i] = 1
              else: 
                  arr[i] = arr[i] + arr[i - 1]  
              row.append(arr[i])
          result.append(row)
      
      for row in result:
          for num in row:
              print(num, end=" ")
          print()
      
      return result
output:     arr = [0 for i in range(n)] 
      result = []
  
      for line in range(0, n): 
          row = []
          for i in range(0, line + 1): 
              if (i == 0 or i == line): 
                  arr[i] = 1
              else: 
                  arr[i] = arr[i] + arr[i - 1]  
              row.append(arr[i])
          result.append(row)
      
      for row in result:
          for num in row:
              print(num, end=" ")
          print()
      
      return result