Write a function called changeColor that takes as input a picture and an amount to increase or decrease a color by and a number 1 (for red), 2 (for green), or 3 (for blue). The amount will be a number between ?.99 and .99.
What will be an ideal response?
```
def changeColor(picture, amount, number):
for p in getPixels(picture):
if number==1:
value = getRed(p)
value = value +value*amount
setRed(p,value)
if number ==2:
value = getGreen(p)
value = value +value*amount
setGreen(p,value)
if number ==3:
value = getBlue(p)
value = value +value*amount
setBlue(p,value)
```
Note: Because of the requirements of the question, unlike in the previous chapter the value variable can’t just be multiplied by the amount variable. If one did it that way, they’d end up with a image with ninety percent of the red removed with the function all “changeColor(pict,?.10,1)” and not the ten percent requested.
You might also like to view...
Suppose that Computing Services your college or place or work is currently supporting two packages – Software XYZ and Software ABC. They want to drop Software ABC and offer only Software XYZ. For each user reaction, estimate the user’s application familiarity with XZY.
a. “Software XYZ is so much better than Software ABC because it uses better memory management.” b. “Don’t get rid of ABC. I know enough about XYZ to know that I don’t want to use it. For my purposes all I need is software ABC. c. “Why should I learn it? I don’t want to be bothered with learning some stupid system.” d. “I can pretty much do what I need to with XYZ, but it would be nice if more of the tech support people could help with my questions about XYZ.”
Defined names can contain ________
A) uppercase and lowercase letters with spaces B) the same value as a cell reference, such as M$10 C) the letter C by itself D) uppercase and lowercase letters
You might want to include a(n) ________ in a workbook so that users can use it to run a macro
Fill in the blank(s) with the appropriate word(s).
Which proxy servers are the most common type of proxy server?
A. HTTP B. TCP C. IP D. FTP