Note: this question is from a previous version of the class which had slightly different image algorithms. Don't worry too much about the solution of this problem, which uses slightly different image functionality to what you have seen.
def image2(file1, file2): image = SimpleImage(file1) back = SimpleImage(file2) for pixel in image: if pixel.red > 100: out_pixel = out.get_pixel(pixel.x, pixel.y) average = (out_pixel.red + out_pixel.green + out_pixel.blue) // 3 pixel.red = average pixel.green = average pixel.blue = average return image
def fives(n): result =  for top in range(1, n + 1): inner =  for i in range(5): inner.append(top - i) result.append(inner) return result
def parse1(s): result =  search = 0 while True: begin = s.find('@', search) if begin == -1: break end = begin + 1 while end < len(s) and s[end].isalpha(): end += 1 word = s[begin + 1:end] result.append(word) search = end return result