# helper functions
def getRGB(pix):
    return getRed(pix), getGreen(pix), getBlue(pix)

def setRGB(pix, r, g, b):
    setRed(pix,r)
    setGreen(pix,g)
    setBlue(pix,b)

def markYellow(pic):
    for pix in getPixels(pic):
        r, g, b = getRGB(pix)
        if r &gt; 200 and b &lt; 90 and g &gt; 150:
            setRGB(pix, 255, 255, 255) 
        else:
            setRGB(pix, 0, 0, 0)

def pctMarked(pic):
    # is there a more direct way to get the totalPixels?
    # totalPixels = len(pic) # perhaps?
    totalPixels = sum(1 for pix in getPixels(pic))
    whitePixels = sum(getRGB(pix) == (255, 255, 255) for pix in getPixels(pic))
    return whitePixels / float(totalPixels)


Python Condensing Code
What are people's views on this?  To be specific: suppose a PhD student has produced a piece of original mathematical research. Suppose that student's supervisor suggested the problem, and gave a few helpful comments, but otherwise did not contribute to the work.  Should that supervisor still be named as a co-author, or would an acknowledgment suffice?

I am interested in two aspects of this. Firstly the moral/etiquette aspect: do you consider it bad form for a student not to name their supervisor?  Or does it depend on that supervisor's input?  And secondly, the practical, career-advancing aspect: which is better, for a student to have a well-known name on his or her paper (and hence more chance of it being noticed/published), or to have a sole-authored piece of work under their belt to hopefully increase their chances of being offered a good post-doc position?

[To clarify: original question asked by MrB ]
