Question: What if , elif, and else statement should I write in code in Python for this? Given primary colors ( Red , Blue, and Yellow

What if, elif, and else statement should I write in code in Python for this?
Given primary colors (Red, Blue, and Yellow) create a sequence of if, elif, and else statements that will "calculate" two colors mixing.
Your code must:
Take user input for color1 and color2.
Account for all possible color outcomes given those two inputs: *Notice some color combos are similar. Remember the user can input colors in different orders!
Red + Red = Red
Red + Blue = Purple
Red + Yellow = Orange
Blue + Blue = Blue
Blue + Red = Purple
Blue + Yellow = Green
Yellow + Yellow = Yellow
Yellow + Red = Orange
Yellow + Blue = Green
You must also account for user input errors or invalid inputs, since Python is case-sensitive you have to be prepared to handle all variations of color inputs (e.g. red, Red, RED, rEd). Also, be aware a user could input absolutely anything so even though you expect only the three primary colors you also have to account for the user entering something like Shoe. What are you going to do in these cases?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!