Please look on the condition statement more deeply, better to make it clearer also,
if 'color1' == 'red' or 'yellow' and 'color2' == 'red' or 'yellow':
We can add parenthesis to make it clearer,
if ('color1' == 'red') or ('yellow') and ('color2' == 'red') or ('yellow')
If we evaluate one group after another we get,
Code ('color1' == 'red')
It will be returning true
whenever the input is 'red' and false
if it is not 'red'.
Code ('yellow')
No way it evaluate to false
. Because in python, non-empty string (text) is considered as / evaluated to true
. More over you did it twice!
... etc (we've got the problem).
I think you mean something like this,
if (('color1' == 'red') or ('color1' == 'yellow')) and (('color2' == 'red') or ('color2' == 'yellow')):