In this **HackerRank List Comprehensions problem solution in python**, we need to develop a python program that can take four integers as an input separated by lines. and then we need to print all the possible combinations on the output screen.

## Problem solution in Python 2 programming.

lst=[int(raw_input())+1 for i in range(4)] print [[x,y,z] for x in range(lst[0]) for y in range(lst[1]) for z in range(lst[2]) if x+y+z!=lst[3]-1]

## Problem solution in Python 3 programming.

if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) print(list([i,j,k] for i in range(x+1) for j in range(y+1) for k in range(z+1) if i+j+k !=n))

### Problem solution in pypy programming.

if __name__ == '__main__': x = int(raw_input()) y = int(raw_input()) z = int(raw_input()) n = int(raw_input()) print [list([xx,yy,zz]) for xx in range(x+1) for yy in range(y+1) for zz in range(z+1) if xx+yy+zz !=n]

### Problem solution in pypy3 programming.

if __name__ == '__main__': x = int(input()) + 1 y = int(input()) + 1 z = int(input()) + 1 n = int(input()) ans = [[i, j, k] for i in range(x) for j in range(y) for k in range(z) if ((i + j + k) != n)] print (ans)

## 0 Comments