Search item between list with in operator
items = ["aaa", 111, (4, 5), 2.01] # A set of objects tests = [(4, 5), 3.14] # Keys to search for # from w ww . j a va2s .co m for key in tests: # For all keys if key in items: # Let Python check for a match print(key, "was found") else: print(key, "not found!")