Write Python code to demonstrate to remove the tuples if certain criteria met


Topic: Write Python code to demonstrate to remove the tuples if certain criteria met

Solution

ini_tuple = [('b', 100), ('c', 200), ('c', 45), 
                        ('d', 876), ('e', 75)] 
print("intial_list", str(ini_tuple))
result = [i for i in ini_tuple if i[1] <= 100] 
print ("Resultant tuple list: ", str(result)) 



List all Python Programs