input: 
  def print_pattern(n: int) -> None:
      """
      Print a pattern of '#' and spaces where '#' is printed if the sum of the indices is even,
      otherwise a space is printed. The pattern is printed in an n x n grid.
      
      >>> print_pattern(7)
      # # # # #
       # # # # 
      # # # # #
       # # # # 
      # # # # #
       # # # # 
      # # # # #
      """
      for i in range(n):
          for j in range(n):
              if (i + j) % 2 == 0:
                  print('#', end='')
              else:
                  print(' ', end='')
          print()
  
output:     for i in range(n):
          for j in range(n):
              if (i + j) % 2 == 0:
                  print('#', end='')
              else:
                  print(' ', end='')
          print()