Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13921

python 3 using multiple or and’s in an if statement

$
0
0

The code that follows always returns 'orange' I've found other ways to do what I want but I do not understand why this does not work.

color1 = input('select first color')color2 = input('select second color')  if 'color1' == 'red' or 'yellow' and 'color2' == 'red' or 'yellow':    print('orange')else:    print('something else')

Viewing all articles
Browse latest Browse all 13921

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>