Question: *Python question *here is example def rotate90counterclockwise(): # Set up the source and target pictures file = pickAFile() pict = makePicture(file) wid = getWidth (pict)
*Python question
*here is example
def rotate90counterclockwise(): # Set up the source and target pictures file = pickAFile() pict = makePicture(file) wid = getWidth (pict) hgt = getHeight (pict) canvas = makeEmptyPicture(hgt, wid) # Now, do the actual copying--swap X & Y (correctly)! targetX = 1 for sourceX in range(1,getWidth(pict)): targetY = 1 for sourceY in range(1,getHeight(pict)): color = getColor(getPixel(pict,sourceX,sourceY)) setColor(getPixel(canvas, targetY, wid - targetX), color) targetY = targetY + 1 targetX = targetX + 1 show(pict) show(canvas) return canvas
*Write a function that takes any picture as an argument and rotates the given picture 180 degrees. You should create an empty canvas the same size as the original picture and it should contain the rotated image. Once you have rotated the image, display the new image.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
