Answer to Question #256675 in Python for Raju

Question #256675

Remove N in all Tuples


Write a program to remove the given number N in all the tuples if it present.


Sample Input 1

3

Sample output 1

[(1,2,4,5,6), (2,4,6,8), (1,5,7)]


1
Expert's answer
2021-10-25T16:59:09-0400
tuples = [(1, 2, 3, 4, 5, 6), (2, 3, 4, 6, 8), (1, 3, 5, 7)]
n = int(input())
for i in range(len(tuples)):
    tuples[i] = tuple([x for x in tuples[i] if x != n])
print(tuples)

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