def solveNQueens(self, n): return [['.' * v + 'Q' + '.' * (n - v - 1) for v in c] for c in itertools.permutations(range(n)) if (len(set(i + v for i, v in enumerate(c))) == n) and (len(set(i - v for i, v in enumerate(c))) == n)]
I never get the point of these one liners . it looks slick but hard to understand, and you have to break it down to understand it.
if you use this one liner in a project and other engineers have to break down everything you code, then that would be a problem .
writing "longer" but easy to understand code is a better idea