Write Python3 code to demonstrate working of Extract Tuples with all Numeric Strings Using lambda + filter() + isdigit()


Topic: Write Python3 code to demonstrate working of Extract Tuples with all Numeric Strings Using lambda + filter() + isdigit()

Solution

test_list = [("45", "86"), ("Gfg", "1"), ("98", "10"), ("Gfg", "Best")] 
print("The original list is : " + str(test_list)) 
res = list(filter(lambda sub : all(ele.isdigit() for ele in sub), test_list)) 
print("Filtered Tuples : " + str(res)) 



List all Python Programs