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)]
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)
Comments
Leave a comment