Write a function to change a picture to grayscale and then negate it.
Note: All one has to do is combine the grayscale and negate methods
```
def grayscale(picture):
for p in getPixels(picture):
intensity = (getRed(p)+getGreen(p)+getBlue(p))/3 setColor(p,makeColor(intensity ,intensity ,intensity)) for px in getPixels(picture):
red=getRed(px)
green=getGreen(px)
blue=getBlue(px)
negColor=makeColor(255-red, 255-green, 255-blue) setColor(px,negColor)
```
OR (more simply)
```
def grayscale(picture):
for p in getPixels(picture):
intensity = (getRed(p)+getGreen(p)+getBlue(p))/3
intensity = 255-intensity
setColor(p,makeColor(intensity ,intensity ,intensity))
```
You might also like to view...
When is IGMP used?
What will be an ideal response?
String value: "BLACK HORSE" is equal to "Black Horse".
Answer the following statement true (T) or false (F)
FTP can only transfer ASCII files.
Answer the following statement true (T) or false (F)
This type of procedure is generally executed when an event occurs.
A. Method B. Sub C. Module D. Declaration