我试图编写一个程序,要求用户输入两种颜色,然后显示结果颜色。到目前为止,我得到的是:#Define function that prompts user to enter data
def ask():
color1=input('Enter name of first primary color:')
color2=input('Enter name of second primary color:')
mixColors(color1,color2)
#Write function that displays the different color combinations
def mixColors(color1,color2):
if color1==red and color2==blue:
print('Mixing red and blue, you get purple.')
elif color1==blue and color2==red:
print('Mixing blue andred, you get purple.')
elif color1==red and color2==yellow:
print('Mixing red and yellow, you get orange.')
elif color1==yellow and color2==red:
print('Mixing yellow and red, you get orange.')
elif color1==blue and color2==yellow:
print('Mixing blue and yellow you get green.')
elif color1==yellow and color2==blue:
print('Mixing yellow and blue, you get green.')
else:
print("I don't know what you get by mixing", color1,'and',color2,'.')
ask()
运行程序时,出现以下错误消息:
^{pr2}$