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


Topic: 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 = [] 
for i in ini_tuple: 
    if i[1] <= 100: 
        result.append(i) 
print ("Resultant tuple list: ", str(result)) 



List all Python Programs