Write a function to flip a picture over so that if someone was looking right, they end up looking left.

What will be an ideal response?

```
def flipPicture (src):
w = getWidth(src)
h = getHeight(src)
canvas = makeEmptyPicture(w,h)
for i in range(0, w):
for j in range(0,h):
p = getPixel(canvas, w-1-i, j)
p2 = getPixel(src, i, j)
color = getColor(p2)
setColor(p, color)
return canvas
```

Note: All you have to do is change the value you grab from if you were to just copy over the image. So the change is from what would be p = getPixel(canvas, x, j) to p =getPixel(canvas, w-1-i, j).

Computer Science & Information Technology

You might also like to view...

The continuous attribute can also be discretized using a clustering ap- proach.

i. Plot a graph of temperature versus pressure for the data points
shown in Table 7.4.

Computer Science & Information Technology

In a ____ architecture, the data frame begins to exit the switch almost as soon as it begins to enter the switch.?

A. ?forward B. ?backward C. ?cut-through D. ?random-propagation

Computer Science & Information Technology