Sam,
SHORT REPLY: See the proper way to write your IF query and how to compare things, below.
I won’t advise you on using tkinter and have no idea why you include it, at least in the code shown. However, the YES/NO you imported may not at all mean what you think.
>>> from tkinter import YES
>>> from tkinter.messagebox import NO
>>> YES
1
>>> NO
'no'
In your code, lines like this:
color = input('what is your favorite color?')
Will return a character string of whatever you typed in, but not the newline you typed. As such, comparing them should be to another character string unless you convert them to a character.
And, please note you ask for the color twice and all the second one does is replace the first. You could have put it in a different variable name like anotherColor.
You asked how to do an if/then. Strictly speaking, python does not use the keyword then. It uses indentation of lines after a line that ends with a colon.
Your code would look more like this:
# NOTE CODE IS WRONG
if YES:
print('What color?')
# more such code as needed
# Code after the IF completes
# indented back out after a blank line.
But I not an error in your approach.
The if statement in python is quite flexible but my bet is you meant to ask if the variable called color in your code currently, matches what YES contains. Unfortunately, it seems YES is mapped to the numeric digit 1. By the rules of the Python Gods, any integer other than 0 is deemed true, or I should say truthy. so your if statement is inevitably true.
Before I supply code, decide what the user should type when asked if they want another color. An example would be to expect exactly “yes” in all lowercase. You can match more complex things when ready. But you need to tell the if statement what you want. Consider my modification of your code:
# ...
another = input('Is there any other color you like? [yes] or [no]')
if another == "yes":
print('What color?')
color2 = input('My other favorite color is: ')
print( color2, 'is a good color')
# Any additional code
If I misunderstood your purpose, someone else may explain better. I assume the assignment contains more such as what to do with two or more colors, …
Good Luck.