Modify any of the functions from the last chapter to use a nested loop. Check the result to make sure it still does the same thing.

There any many potential options here, but they all require the same approach. Instead of looping through each pixel, loop through the x values and the y values as two separate loops. The most useful functions to do this in are those that only make changes over a range, as it avoids checking a lot of unnecessary pixels. For example, the removeRedEye function:


```
def removeRedEye(pic,startX,startY,endX,endY,endColor):
for x in range(startX, endX):
for y in range(startY, endY):
px = getPixel(pic, x, y)
if (distance(red,getColor(px)) < 165):
setColor(px,endColor)
```

Computer Science & Information Technology

You might also like to view...

A well-designed method ________.

a. performs multiple unrelated tasks b. repeats code found in other methods c. contains thousands of lines of code d. performs a single, well-defined task

Computer Science & Information Technology

The Outline is a printout that has an image of the slide on the top of the page and notes on the bottom of the page

Indicate whether the statement is true or false

Computer Science & Information Technology

To move the active cell up one row, press ____.

A. Shift + Enter B. Ctrl + Tab C. Shift + Tab D. Ctrl + Enter

Computer Science & Information Technology

Describe why dial-up connections are less susceptible to external threats than broadband connections.

What will be an ideal response?

Computer Science & Information Technology