All problems
Flatten Channels
Problem
Flatten an RGB image into a single list of channel values.
Values are emitted in row-major pixel order, and within each pixel in r, g, b order. An empty image returns [].
Test cases
case 1
in: [[[[1,2,3],[4,5,6]]]]
expected: [1,2,3,4,5,6]
case 2
in: [[[[7,8,9]]]]
expected: [7,8,9]
case 3
in: [[]]
expected: []
Starter codePython
def flatten_channels(image):
# Your code here
pass3 test cases · run your code against them in the editor