From my standard input I take two words and I want to process them if they occur in a dictionary. This means that I can have both, one or none of the words match (in which case I will wrap up the code with an error message). This is very similar to a boolean OR gate. I can write my script like this:
if word1 in dict and word2 in dict:
# process word1
# process word2
elif word1 in dict:
# process word1
elif word2 in dict:
# process word2
else:
# error msg
However, this seems rather redundant. Is there a simple alternative to this? I have a separate function that processes one of these words at a time.