import media def get_picture(): '''Let the user select a picture file, display that picture, then return it''' filename = media.choose_file() pic = media.load_picture(filename) media.show(pic) return pic def make_sunset(pic): '''Make the picture pic look like it was taken at sunset, then display that picture''' # Reduce the blue and green by 30% each to make # the red stand out. for pixel in pic: green = media.get_green(pixel) media.set_green(pixel, int(green * 0.7)) blue = media.get_blue(pixel) media.set_blue(pixel, int(blue * 0.7)) media.show(pic) if __name__ == '__main__': pic = get_picture() make_sunset(pic)