Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What code should I write in Python? Given primary colors ( Red , Blue, and Yellow ) create a sequence of if , elif, and

What code should I write in Python?
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!
o Red + Red = Red
o Red + Blue = Purple
o Red + Yellow = Orange
o Blue + Blue = Blue
o Blue + Red = Purple
o Blue + Yellow = Green
o Yellow + Yellow = Yellow
o Yellow + Red = Orange
o 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?
Example of what an output could be:Choose a primary color (Red, Blue, or Yellow) Yellow
Choose a second primary color (Red, Blue, or Yellow) Blue
Yellow and Blue combined create green.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

What social concerns surround geolocation technologies?

Answered: 1 week ago

Question

Evaluate the expression. 50 49

Answered: 1 week ago

Question

=+ What is the nature of the contracts or agreements with unions?

Answered: 1 week ago

Question

=+What is the procedure for labor relations in the workplace?

Answered: 1 week ago

Question

=+ Are ballots compulsory?

Answered: 1 week ago