Question
In python pls! def color_mixer(red, green, blue): Accepts three integer parameters for the three lights (red, green, blue; in that order) and performs the following
In python pls!
def color_mixer(red, green, blue): Accepts three integer parameters for the three lights (red, green, blue; in that order) and performs the following actions:
Determines if the color values are valid (i.e. between 0 and 255, inclusive)
o The function will return the string "bad color!" if any of the color values is invalid.
Determines the color created by mixing the lights
o Note: a value of 0 indicates that the light is turned off.
Returns the color as a string "red", "green", "blue", "yellow", "magenta", "cyan", "white", or "black"
o Note: dont worry if there is only a little red light and a lot of blue light, for our purposes, that would make a magenta light.
Examples:
o # we have no red, no green, and a blue value of 5 color_mixer(0,0,5) 'blue'
o # we have no red, no green, and an invalid blue value color_mixer(0,0,300) 'bad color!'
o # we have all three colors color_mixer(1,5,10) 'white' o # we have red and green color_mixer(1,255,0) 'yellow'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started