PSEUDOCODE PLEASE! Color Mixer The colors red, blue, and yellow are known as the
ID: 3909588 • Letter: P
Question
PSEUDOCODE PLEASE!Color Mixer 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: When you mix red and blue, you get purple. When you mix red and yellow, you get orange. When you mix blue and yellow, you get green. Design a program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than “red,” “blue,” or “yellow,” the program should display an error message. Otherwise, the program should display the name of the secondary color that results.
PSEUDOCODE PLEASE!
Color Mixer 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: When you mix red and blue, you get purple. When you mix red and yellow, you get orange. When you mix blue and yellow, you get green. Design a program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than “red,” “blue,” or “yellow,” the program should display an error message. Otherwise, the program should display the name of the secondary color that results.
PSEUDOCODE PLEASE!
Color Mixer 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: When you mix red and blue, you get purple. When you mix red and yellow, you get orange. When you mix blue and yellow, you get green. Design a program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than “red,” “blue,” or “yellow,” the program should display an error message. Otherwise, the program should display the name of the secondary color that results.
Explanation / Answer
print("enter two primary colors to mix")
color1=input("enter color 1");
color2=input("enter color 2");
if((color1=="red" || color1=="blue" || color1=="yellow") && (color2=="red" || color2=="blue" || color2=="yellow")){
if(color1=="red" && color2=="blue"){
print("purple");
}
else if(color1=="red" && color2="yellow"){
print("orange");
}
else if(color1=="blue" && color2=="yellow"){
print("green");
}
}
else{
print("only primary colors are allowed");
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.