Python – List Comprehension

Let’s learn about list comprehensions! You are given three integers  x, y, z and  representing the dimensions of a cuboid along with an integer n . Print a list of all possible coordinates given by  on a 3D grid where the sum of  is not equal to n . Please use list comprehensions rather than multiple loops

Example
x = 1

y = 1

z= 2

n = 3


All permutations of [i,j,k]  are:

[[0,0,0], [0,0,1], [0,0,2], [0,1,0],[0,1,1]………..]

Print an array of the elements that do not sum to n.

if __name__ == '__main__':
    print('Please enter value x :')
    x = int(input())
    print('Please enter value y :')
    y = int(input())
    print ('Please enter value z :')
    z = int(input())
    print('Please enter elements that do not sum to:')
    n = int(input())

print([[i, j, k] for i in range(0, x+1) for j in range(0, y+1) for k in range(0,z +1) if i+j+k != n])