Question: PYTHON Problem 2 prod_digits(mm): Repeated product of digits (fixpoint) [5 points] Write a function prod_digits(x) that accepts a multidimensional array filled with non-negative integers and
PYTHON
Problem 2 prod_digits(mm): Repeated product of digits (fixpoint) [5 points] Write a function prod_digits(x) that accepts a multidimensional array filled with non-negative integers and repeatedly computes the product of non-zero digits, until the result is a single-digit number. For example, the number 512983 is 2, because 512983 = 2160 and 216 = 12 (note the ommission of the zero digit) and 1 2 = 2. Similarly, the ultimate product of 8969978956959938 is
8,because 8969978956959938 = 46283834419200 and
462838344192 = 7962624 and 7962624 = 36288 and 3
6 2 8 8 = 2304 and 2 3 4 = 24 and 2 4 = 8.
Your function should return a multi-dimensional array with the numbers reduced to their single digit products.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
