Multiply array values, return the remainder

Question

Suppose you're given an array of varying length containing multiple #s, and a number x. Using these inputs, write a short program in Python find the remainder of the array multiplication divided by x.

For example:

#Given the following
array = [5,2,4,1,5]
x = 6

#We would calculate output as such:
5*2*4*1*5 = 200 % 6 = 2

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now