Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Final Exam Review Spring 2003: Converting to Methods

Questions, answers, comments?

(Back to Sp2003 Final Exam Review)


Just an FYI: There is supposed to be an asterisk in the sunset code given for the example...It didn't show up when the professor wrote the problem, but it needs to be there for the code to work. Check the slides from the objects.ppt to get the correct code for makeSunset in method form.
Lauren Biddle
Fixed now, Lauren – thanks! Mark Guzdial

(a)
def clearRed(picture):
  for p in getPixels(picture):
    p.setRed(p.getRed()*0.0)

(b)
def greyscale(picture):
  for p in getPixels(picture):
    luminance=((p.getRed()+p.getBlue()+p.getGreen())/3)
    p.setColor(makeColor(luminance, luminance, luminance))
(c)
def negative(picture):
  for p in getPixels(picture):
    p.setColor(makeColor(255-p.getRed(),255-p.getGreen(),255-p.getBlue()))
Lauren Biddle

Those got awfully small, didn't they! Mark Guzdial

Will u show the example in each question in the exam like u did here?
"u"? Is that a variable standing for an unknown quantity? English, please. Mark Guzdial
"U" means "YOU". could you please answer the question now, sir.
Sorry – huffier than I meant to be. Yes, I always give you examples to work from if there's code to be written. Mark Guzdial




Link to this Page