daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Nov 16th, 2018 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def f(M):
  2.     l=[]
  3.     for i in range(1,M.getNoLines):
  4.         for j in range(1,M.getNoColumns):
  5.             if M.get(i, j)!=0:
  6.                 if M.get(i-1,j)!=M.get(i,j) and M.get(i,j-1)!=M.get(i,j):
  7.                     el=getCenter(M,i,j)
  8.                     if el not in l:
  9.                         l.append(el)
  10.     return l
  11.  
  12.  
  13. def getCenter(M,i,j):
  14.     i1=i
  15.     j1=j
  16.     while M.get(i,j)==M(i1,j):
  17.         i1+=1
  18.     i1-=1
  19.      while M.get(i, j) == M(i, j1):
  20.         j1 += 1
  21.     j1 -= 1
  22.     return (int(float(i1-i)/2+i),int(float(j1-j)/2+j)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top