0
while True:
    COLOR = input('Please enter green or blue: (green/blue) ').lower()
    if COLOR == 'blue' or 'green':
        print('correct!')
        break
    else:
        print('Please enter green or blue.')
        continue

Terminal: Please enter green or blue: (green/blue) asdfasefase correct!

even though the input does not match the variable it still is true, why?

2 Answers2

-1

your if statement is wrong. It needs to be:

if COLOR == 'blue' or COLOR == 'green'

in your case or 'green' will always be interpreted as true hence anything will be correct

Šeky
  • 26
  • 3
-1
while True:
COLOR = input('Please enter green or blue: (green/blue) ').lower()
if COLOR == 'blue' or COLOR =='green':
    print('correct!')
    break
else:
    print('Please enter green or blue.')
    continue

try this