Home / Expert Answers / Computer Science / programming-language-is-python-2-color-mixer-adapted-from-7-save-the-file-as-ch3-ex2-py-the-pa127

(Solved): Programming Language is Python 2. Color Mixer (adapted from #7) - Save the file as ch3_ex2.py The ...



Programming Language is Python

2. Color Mixer (adapted from #7) - Save the file as ch3_ex2.py
The colors red, blue, and yellow are known as the primary colo

Your output should be formatted like the following for duplicate entries:
Enter the first primary color in lower case letters

2. Color Mixer (adapted from #7) - Save the file as ch3_ex2.py The colors red, blue, and yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here: Write a program that prompts a user to enter two different primary colors and then shows the resulting secondary color. Your program must: - Prompt the user to enter the color names (red, blue, and yellow) in lower case (because blue != BLUE != Blue) - Validate that the first color entered is either red, blue or yellow - Validate that the second color entered is either red, blue or yellow - Validate that the same color is not entered twice - Allow for the possibility that the colors are entered in reverse order (red+blue=purple, but also blue+red=purple) Your output should be formatted like the following for valid entries: Enter the first primary color in lower case letters: red Enter the second primary color in lower case letters: blue Color Mixer Results: red + blue = purple. Your output should be formatted like the following for an invalid first entry: Enter the first primary color in lower case letters: purple Enter the second primary color in lower case letters: blue Color Mixer Results: purple + blue = error: first color is invalid. Your output should be formatted like the following for an invalid second entry: Enter the first primary color in lower case letters: blue Enter the second primary color in lower case letters: green Color Mixer Results: blue \( + \) green \( = \) error: second color is invalid. Your output should be formatted like the following for duplicate entries: Enter the first primary color in lower case letters: red Enter the second primary color in lower case letters: red Color Mixer Results: red \( + \) red \( = \) error: colors are the same.


We have an Answer from Expert

View Expert Answer

Expert Answer


color1 = input("Enter the first primary color in lower case letters: ") color2 = input("Enter the second primary color in lower case letters: ") # validation for color 1 if not(color1 == "red" or color1 == "blue" or color1 == "yellow"): print
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe