All problems
Invert Image
Problem
Invert a grayscale image whose pixel values lie in [0, 255].
Each output pixel is 255 minus the corresponding input pixel.
Test cases
case 1
in: [[[0,255],[100,150]]]
expected: [[255,0],[155,105]]
case 2
in: [[[1]]]
expected: [[254]]
case 3
in: [[[0,0],[0,0]]]
expected: [[255,255],[255,255]]
Starter codePython
def invert_image(image):
# Your code here
pass3 test cases · run your code against them in the editor