Test for membership with in : Tuple In « Tuple « Python






Test for membership with in

Test for membership with in
inventory = ("a",
             "b",
             "c",
             "d")
       
       

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


           
       








Related examples in the same category

1.in function for a string and a tuplein function for a string and a tuple
2.Print each element in the tuplePrint each element in the tuple