Define a function named posterize. This function expects an image and a tuple of RGB values as arguments.
def posterize(img, rgb_tuple): """Given a tuple of RGB values and an image, returns a copy of the image with each color replaced by the corresponding values from the tuple.""" new_img = img.copy() for pixel in new_img: for i in range(3): pixel[i] = rgb_tuple[i] return new_img