Question: 1.3.12 isGray Background: As noted in the previous exercise, we can represent colors as RGB values. That is, as 3 integers representing the amount of

1.3.12 isGray Background: As noted in the previous exercise, we can represent colors as RGB values. That is, as 3 integers representing the amount of red, green, and blue in the color. In this exercise, we will represent RGB values as 9 digit integers, where the leftmost three digits represent red, the next three digits represent green, and the last three digits represent blue. Each of the red, green, and blue values are between 0 and 255 (inclusive), where 255 is "entirely on" and 0 is "entirely off". For example, the RGB values of orchid (a purplish color) are 218, 112, and 214. We will represent that as the single integer 218112214 . Note that the integer does not necessarily have to be nine digits, since it could contain leading zeroes. For example, if the RGB values are 000, 032, 175 , then we will represent that as the single integer 32175 . Also, a color is a shade of gray if it has equal amounts of red, green, and blue. For example, the RGB integer 112112112 represents a medium shade of gray. With this in mind, write the function isGray (rgb), which takes an rgb value, and returns True if the color is a shade of gray, and False otherwise
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
