Applying 'filter' to a list

 

def name(item):
    if item == "abdur":
        return True
    else:
        return False
   
list1 = ["abdur", "michael", "vikky"]
 
b = list(filter(name, list1))
print(b)




Comments

Popular posts from this blog

Quotation marks to wrap an element in HTML

The Basic Structure of a Full-Stack Web App

Unlocking Web Design: A Guide to Mastering CSS Layout Modes