Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. def exchangeRowAndColumn(A,x,y):
  2. # @param A: Picture;
  3. # @param x: int; column number
  4. # @param y: int; row number
  5.   if getWidth(A) != getHeight(A) or x >= getWidth(A) or y >= getHeight(A) or x<0 or y<0:
  6.     print "Error in parameter settings"
  7.      
  8.   for i in range(0,getWidth(A)):
  9.     for j in range(0,getHeight(A)):
  10.       px_1 = getPixel(A,i,y)
  11.       color_1 = getColor(px_1)
  12.       px_2 = getPixel(A,x,j)
  13.       color_2 = getColor(px_2)
  14.       setColor(px_1,color_2)
  15.       setColor(px_2,color_1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement