Question: Define red_filter function that takes a 2D list img as its parameter. The function has to maintain the R components of img but reduce its

 Define red_filter function that takes a 2D list img as its

Define red_filter function that takes a 2D list img as its parameter. The function has to maintain the R components of img but reduce its G, B components all as 0. Define the function without any return statement. Sample Input 1: [[(255, 0, 0), (0, 255, 0), (0, 0, 255)], [(255, 0, 0), (0, 255, 0), (0, 0, 255)], [(255, 0, 0), (0, 255, 0), (0, 0, 255)]] Sample Output 1: [[(255, 0, 0), (0, 0, 0), (0, 0, 0)], [(255, 0, 0), (0, 0, 0), (0, 0, 0], [(255, 0, 0), (0, 0, 0), (0, 0, 0)]] Sample Input 2: [[(1, 2, 3), (4, 5, 6)], [(7, 8, 9), (10, 11, 12)], [(13, 14, 15), (16, 17, 18)], [(19, 20, 21), (22, 23, 24)], [(25, 26, 27), (28, 29, 30)]] Sample Output 2: [[(1, 0, 0), (4, 0, 0)], [(7, 0, 0), (10, 0, 0)], [(13, 0, 0), (16, 0, 0], [(19, 0, 0), (22, 0, 0)], [(25, 0, 0), (28, 0, 0)]]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!