def n_queens(queen_count):
 cols = range(queen_count)
 for vec in permutations(cols):
  if (queen_count == len(set(((vec[i] + i) for i in cols))) == len(set(((vec[i] - i) for i in cols)))):
   (yield vec)

def n_queens ( queen_count ) : cols = range ( queen_count ) for vec in permutations ( cols ) : if ( queen_count == len ( set ( ( ( vec [ i ] + i ) for i in cols ) ) ) == len ( set ( ( ( vec [ i ] - i ) for i in cols ) ) ) ) : ( yield vec )
n-queens solver .