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

Midterm Exam 1 Review Fall 2004: Which does which

Post your answers, questions, comments, comments on answers, suggestions, suggestions on questions, etc.

Back to Fall2004 Midterm 1 Review


i say D

def noBlue(picture):
blue = makeColor(0,0,100)
for p in getPixels(picture):
color = getColor(p)
if distance(color,blue) > 100:
setBlue(p,0)
for this one...will this distance also include the color where the blue value is 0...aka not greater than 100?


It will include all colors that are greater than 100 distance from blue. If the blue value is 0, it still depends on the value of red and green. Review the distance formula. Take then color you are uncertain about and plug it into the formula. If the function returns a number > 100 then it will be affected, otherwise it will not. Kelly Lyons

I do not think that any of the code will do what the question asks.

for d to work wouldn't the if statement have to be indented- as of now it falls directly under the for loop

yeah, i guess d wont work because the if is not indented. would it work if the if was indented?

It looks like that's just a typing error, pretend like it is indented correctly! Summer McWilliams

i think d is the only correct answer as well


D because its the only one that calls for the blue values GREATER than 100


None of them seem to be testing for a blue VALUE of 100, only a distance from blue of 100. None of them satisfy what is described in the question.

sure look at D. where do you see the distance fucntion?



D

D

Why not C? is it because of the line blue = makeColor(0,0,100) which would make a lot of blue?

Because the distance from (255,255,1) is greater than 100 distance from blue which is the (0,0,100) so it will set the blue to 0 even though the blue value is not more than 100. Review what the distance function does to understand this more Kelly Lyons

Link to this Page