Answered step by step
Verified Expert Solution
Question
1 Approved Answer
def reduce matrix(mat) .Reduces the size of matrix mat in half, in both dimensions, by merging adjacent elements The new values of the matrix are
def reduce matrix(mat) .Reduces the size of matrix mat in half, in both dimensions, by merging adjacent elements The new values of the matrix are the average of the respective merged elements Return value is None. Variable mat is directly modified in memory . mat is a nested list (e.g. [I1,2,3,41, [5,6,7,811 and is guaranteed to be non-empty and have a rectangular shape. Both dimensions are even numbers .You're not allowed to use slicing, or import modules, or use the list comprehension syntax The only functions you're allowed to use are: lenO, range) and the del keyword Examples: o reduce matrix(1,2],13,411 o reduce matrix(I1,2,3,41.15,6,7,81,19,8,7,61,[5,4,3,2]])3.5,5.51,[6.5,4.51] T12.511
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started