Write a function to interleave two pictures taken as input. Take the first 20 pixels from the first picture and then 20 pixels from the second picture and then the next 20 pixels from the first picture and then the next 20 pixels from the second picture and so on till all the pixels have been used.
What will be an ideal response?
```
def interleavePictures(pic, picTwo):
numPixels = 0
for px in getPixels(pic):
numPixels = numPixels +1
x = getX(px)
y = getY(px)
val = numPixels/20
if val%2 ==1:
secondPx = getPixel(picTwo, x, y)
pxcol = getColor(secondPx)
setColor(px,pxcol)
```
Note: There are many different ways to accomplish the interleaving. The important thing is that the switch occurs every 20 pixels, not how it occurs. One possibility is to track which of the two pictures the function pulls from at any moment, such as:
```
def interleavePictures(pic, picTwo):
numPixels = 0
currentPicture = 1
for px in getPixels(pic):
numPixels = numPixels +1
x = getX(px)
y = getY(px)
if numPixels ==20:
if currentPicture==1:
currentPicture = 2
elif currentPicture==2:
currentPicture = 1
numPixels = 0
if currentPicture==2:
secondPx = getPixel(picTwo, x, y)
pxcol = getColor(secondPx)
setColor(px,pxcol)
```
You might also like to view...
Which of the following is NOT a primary function of an operating system?
A) Managing document formatting options B) Communicating with application software C) Managing system resources D) Checking computer components
_____________includes the process of providing breeder documents, identity history, credentials, and documents to establish an identity to an organization that can issue identity credentials.
Fill in the blank(s) with the appropriate word(s).