Write a python program for removing strings from tuple and printing it


Topic: Write a python program for removing strings from tuple and printing it

Solution

test_list = [('Geeks', 1, 2), ('for', 4, 'Geeks'), (45, 'good')] 
  
print("The original list : " + str(test_list)) 
s=[]
for i in test_list:
    t=tuple()
    for j in i:
        if not isinstance(j,str):
           t+=(j,)
    s.append(t)       
print(f'List after removing string from tuple is {s}')



List all Python Programs