title: Find the coordinates of a cuboid using list comprehension in Python
body: <p><code>X</code>, <code>Y</code> and <code>Z</code> are the three coordinates of a cuboid.</p>
  
  <p>Now X=1,Y=1, Z=1 and N=2.</p>
  
  <p>I have to generate a list of all possible coordinates on a 3D grid where the sum of Xi + Yi + Zi is not equal to N. If X=2, the possible values of Xi can be 0, 1 and 2. The same applies to Y and Z.</p>
  
  <p>I have written this below code so far, and it is giving the output as : </p>
  
  <pre><code>[[0, 0, 0]]
  </code></pre>
  
  <p>however the expected output is</p>
  
  <pre><code>[[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 1]]
  </code></pre>
  
  <p>Below is my code, what is going wrong in my code?</p>
  
  <pre><code>[[x,y,z] for x in range(X) for y in range(Y) for z in range(Z) if x+y+z != N]
  </code></pre>