input: 
  from typing import List
  
  def print_pattern(n: int) -> str:
      """
      Print a 2D pattern of size n x n where elements at positions (i, j) 
      are printed as '#' if the sum of their indices is even, otherwise as ' '.
  
      Example:
      >>> print(print_pattern(7))
      # # # # #
       # # # #
      # # # # #
       # # # #
      # # # # #
       # # # #
      # # # # #
      """
      pattern = ""
      for i in range(n):
          for j in range(n):
              if (i + j) % 2 == 0:
                  pattern += '#'
              else:
                  pattern += ' '
          pattern += '\n'
      return pattern.strip()
  
output:     pattern = ""
      for i in range(n):
          for j in range(n):
              if (i + j) % 2 == 0:
                  pattern += '#'
              else:
                  pattern += ' '
          pattern += '\n'
      return pattern.strip()