input: Write a function to generate a pattern of alternating '#' and spaces in a 7x7 grid. The pattern should place a '#' if the sum of the row index and column index is even, otherwise, it should place a space. If the grid size is not 7x7, return an empty string.
  assert generate_pattern(7)=='#######\n # # # #\n#######\n # # # #\n#######\n # # # #\n#######\n'
  assert generate_pattern(5)==''
  assert generate_pattern(10)==''
output: def generate_pattern(size):
      if size != 7:
          return ''
      result = []
      for i in range(size):
          row = ''
          for j in range(size):
              if (i + j) % 2 == 0:
                  row += '#'
              else:
                  row += ' '
          result.append(row)
      return '\n'.join(result) + '\n'