Answer to Question #205803 in Python for Chavali Anand Babu

Question #205803

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)
1
Expert's answer
2021-06-11T22:33:18-0400

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))
                    

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS