All problems
Grayscale by Average
Problem
Convert an RGB image to grayscale using the simple channel average.
For each [r, g, b] pixel return round((r + g + b) / 3, 2). An empty image returns []; this differs from the weighted luminance conversion.
Test cases
case 1
in: [[[[0,0,0],[255,255,255]]]]
expected: [[0,255]]
case 2
in: [[[[30,60,90]]]]
expected: [[60]]
case 3
in: [[[[1,2,4]]]]
expected: [[2.33]]
case 4
in: [[]]
expected: []
Starter codePython
def grayscale_average(image):
# Your code here
pass4 test cases · run your code against them in the editor