|Welcome to CS1315. Click on the python to add comments.|
|This page removed for FERPA compliance|
Fall 2006 Midterm 1 Review - Color-blind
I'd like to know if I'm on the right track or if it's correct. The program works but I'm not sure if it's correct.
for p in getPixels(picture):
greenValue = getREMOVED(p)
redValue = getREMOVED(p)
setRed(p, (greenValue + redValue)/2)
setREMOVED(p, (greenValue + redValue)/2)
Why does JES return an error message when you try to perform this exact function?
|REMOVEDs for me. Did you remember to load it? Colin Potts|
shouldn't it be redValue = getRed instead of getREMOVED?
Come on BB....Stacy Schwaiger
My bad yo... I meant the other way :D
why do you put return picture at the bottom?
|For every function you write, it's a good idea to return the picture, so that it can be used later. Its optional unless specified in the question. So, in the exam, make sure whether we're asking you to show the picture or return the picture or both. - Bobby Mathew|
for px in getPixels(picture):
setColor(px, makeColor(newRed, newREMOVED, newBlue))
I did it this way. Is there anything wrong with this, cause it works, but I was just wondering if there was anything technically wrong with it.
|This is fine. It's a matter of programming style. I like the way you create new values for each color, calculating the red, copying the green from the newly calculated red, and just cloning the old blue. Nice. Colin Potts|
for pixel in getPixels(myPicture):
Link to this Page