I have a very long list like this:
old_list = ['cat','dog','bat','cat',...]
I am using the following code to copy this entire list into another with changes for some specific conditions:
new_list = []
for item in old_list:
if item == ("cat" or "bat"):
new_list.append("a")
elif item == "dog" or "fog" or "sog" or "log":
new_list.append("o")
else:
new_list.append(item)
The problem is that in some cases "cat" and "bat" are correctly replaced by "a" but in some cases "cat" or "bat" remains as it is when I print new_list
What am I doing wrong?