I'm trying to search a list I have for specific values and if any of those values exist in the list, I would like to perform a different operation.
Currently this is the list I am working with:
print(categories)
['Creams', 'Bath', 'Personal Care']
What I would like to do is search this categories list for some different values. To do this, I've converted categories into a set and am individually searching for each of the values with an if statement.
For example:
c = set(categories)
if "Conditioners" in c:
print("1")
if "Bath" in c:
print("2")
if "Shaving Gels" in c:
print("3")
Which returns:
2
What I would ideally like to do is put my criteria into a list or some other relevant data structure and have it perform that particular operation if that value exists within categories in an efficient manner.