0

I am trying to check if colors contain either blue or green with red, and it is not working. Am I suppose to use the "or" operator inside of the pipe " | ". Or am I suppose to have the pipe outside of the parenthesis? I've tried everything and I don't understand what I'm doing wrong.

colors = 'red red'

if ('blue|green') and 'red' in colors:
     print(True)

>>> True
EatSleepCode
  • 452
  • 7
  • 21

0 Answers0