#create the mirror image of a picture # #A little geometry: The reflection of the #pixel at position X,Y is the pixel at positon #width+1-X,Y # #This corrects the error in the first version by #swapping in place. It illustrates looping over #ranges def mirror3(): file=pickAFile() sourcepic=makePicture(file) height=getHeight(sourcepic) width=getWidth(sourcepic) for y in range(1,height): for x in range(1,width/2): px=getPixel(sourcepic,x,y) px2=getPixel(sourcepic,width+1-x,y) saveColor=getColor(px2) setColor(px2,getColor(px)) setColor(px,saveColor) show(sourcepic)