python COMPILER ERROR MESSAGES SyntaxError: invalid syntax (ColorMixer.py, line
ID: 3745921 • Letter: P
Question
python
COMPILER ERROR MESSAGES SyntaxError: invalid syntax (ColorMixer.py, line 10) 10 print ( You didn't input two primary colors. ') 1 color1-input ('Enter primary color:) 2 color2-input ('Enter primary color:') 3 if color1'red' and color2--'blue' or color1'blue' and color2- 'red': 4 print( 'When-you mix red and blue, you get purple') if colorl-'red' and color2yellow or color1 'yellow' and color2-'red': rint ( 'When you mix red and yellow, you get orange) if color1-='blue' and color2-=.yellow" or color1-='yellow, and color2-'blue": 6 print ( 'When you mix blue and yellow, you get ereen') else: 10 print( 'You didn't input two primary colors.Explanation / Answer
color1=input('Enter primary color:')
color2=input('Enter primary color:')
if(color1==color2):
print('Wnen you mix red and blue,you get purple')
if color1=='red' and color2=='blue' or color1=='blue' and color2=='red':
print('Wnen you mix red and yellow,you get orange')
if color1=='blue' and color2=='yellow' or color1=='yellow' and color2=='blue':
print('Wnen you mix blue and yellow,you get green')
else:
print('you didn't input two variable')
Comment: In the else statement you used an extra apostrophe that is the reason error is came. If you want to use any apostrophe you declare ' instead of single apostrophe '.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.