sir in the above question id #176334 some erorr ocurred your output should be show this type
(0, 12, 17)
(0, 8, 21)
(12, 8, 9)
but original out put this
Sample Input 1
0 12 17 8 9 21
29
Sample Output 1
(0, 8, 21)
(0, 12, 17)
(8, 9, 12)
Sample Input 2
0 1 2 3 5 7 13 17 19 19
22
Sample Output 2
(0, 3, 19)
(0, 5, 17)
(1, 2, 19)
(2, 3, 17)
(2, 7, 13)
This code works.
input1 = [0, 1, 2, 3, 5, 7, 13, 17, 19, 19] //You can change this list
for row in input1:
for col in input1:
if (col + row) == 22: //You can modify the value
if col < row:
print("({},{},{})".format(0,col, row))
else:
for colo in input1:
if (col + row + colo ) == 29:
if col < row and colo < row:
print("({},{},{})".format(colo,col, row))
Comments
Leave a comment