input: Write a function to generate a 7x7 grid where each cell is either a '#' or a space character depending on whether the sum of its row index and column index is even or odd. Print the grid row by row. If the input is invalid, return None.
  assert generate_grid()
  assert generate_grid()
  assert generate_grid()
  assert generate_grid()
  assert generate_grid()
output: def generate_grid():
      grid = []
      for i in range(7):
          row = []
          for j in range(7):
              if (i + j) % 2 == 0:
                  row.append('#')
              else:
                  row.append(' ')
          grid.append(row)
      return grid