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

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!