Correzione soluzione problema 3

a guest Nov 12th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def checkRedValue(pic,k):
  2. # @param pic : picture
  3. # @param k : int  
  4. # @return : bool (True se il valore di k e' uguale alla somma dei valori di red di almeno una riga, False se non lo e')
  5.     for y in range(0,getHeight(pic)):
  6.        redv=0
  7.        for x in range(0,getWidth(pic)):
  8.            pix=getPixel(pic,x,y)
  9.            redpix=getRed(pix)
  10.            redv=redv+redpix
  11.        if redv==k :
  12.           return True
  13.     return False
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