col1 = input('Please input the first color: ')
col2 = input('Please input the second color: ')
while True:
if (col1 == 'red' and col2 == 'blue') or (col1 == 'blue' and col2 == 'red'):
print('purple')
elif (col1 == 'red' and col2 == 'yellow') or (col1 == 'yellow' and col2 == 'red'):
print('orange')
elif (col1 == 'blue' and col2 == 'yellow') or (col1 == 'yellow' and col2 == 'blue'):
print('green')
if col1 not in ['red', 'blue', 'yellow']:
print('Invalid')
break
I'm trying to let the user answers 'red', 'blue' or 'yellow'. If they do not answer in that list, the program will print ('invalid') and start the loop by asking the user again which 2 colors to mix.