I want to match the correct terms from my list. Here is my code:
stuff = ["cat", "dog", "house", "cat", "mouse"]
for item in stuff:
if "house" in item:
print "house good"
if "cat" in item:
print "cat good"
if "dog" in item:
print "dog good"
else:
print "nothing else"
The results are currently this:
cat good
nothing else
dog good
house good
nothing else
cat good
nothing else
nothing else
But I want the results to be this:
cat good
dog good
house good
cat good
nothing else
Currently the script keeps pulling "nothing else" because of my else statement. But I don't know how to only making "nothing else" come up exclusively when a term in my list doesn't match the terms in my if statements. Does anyone know I can do this?