test for List membership with in : List In « List « Python






test for List membership with in

test for List membership with in

inventory = ["sword", "armor", "shield", "healing potion"]



if "healing potion" in inventory:
    print "You will live to fight another day."

           
       








Related examples in the same category

1.List membership demoList membership demo
2.Use in to check Membership Use in to check Membership