Imagine that you have a picture, and you are painting a copy of it. But you have only eight colors. Write a function that inputs a picture, and makes these changes to each pixel. For each of red, green, and blue, if the component is less than 100, make it zero. Otherwise, make it 255.

What will be an ideal response?


```
def paintLimited(picture):
for p in getPixels(picture):
valueR = getRed(p)
if valueR<100:
setRed(p,0)
else:
setRed(p,255)
valueG = getGreen(p)
if valueG<100:
setGreen(p,0)
else:
setGreen(p,255)
valueB = getBlue(p)
if valueB<100:
setBlue(p, 0)
else:
setBlue(p,255)
```

Computer Science & Information Technology

You might also like to view...

You can apply an entrance effect or an exit effect to an object, but not both to the same object

Indicate whether the statement is true or false

Computer Science & Information Technology

A ____ is any Outlook item such as a task, an email message, or a contact that has been flagged for follow-up later.

A. task cluster B. to-do list C. to-do item D. category

Computer Science & Information Technology

You can click the Format Cells Dialog Box Launcher to open the Format Cells dialog box.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Any field or collection of fields that determines another field is called a(n) ____.

A. attribute B. antipode C. determinant D. descendent

Computer Science & Information Technology