This is a functional problem. Your task is to return the product of array elements under a given modulo. 
The modulo operation finds the remainder after the division of one number by another. For example, K(mod(m))=K%m= remainder obtained when K is divided by m
Example:
Input:
1
4
1 2 3 4
Output:
24
Input:
The first line of input contains T denoting the number of test cases. Then each of the T lines contains a single positive integer N denotes the number of elements in the array. The next line contains 'N' integer elements of the array.
Output:
Return the product of array elements under a given modulo.
That is, return (Array[0]*Array[1]*Array[2]...*Array[n])%modulo.
Constraints:
1<=T<=200
1<=N<=10^5
1<=ar[i]<=10^5

Source: geeksforgeeks | Difficulty: EASY
Tags: Data structures

Starter code: #User function Template for python3



# arr is the array

# n is the number of element in array

# mod= modulo value

def product(arr,n,mod):

    # your code here

Solutions:
from functools import reduce

def product(arr, n, mod):
	x = reduce(lambda a, b: a * b, [a for a in arr])
	return x % mod


def product(arr, n, mod):
	s = 1
	for i in arr:
		s *= i
	return s % mod


import numpy

def product(arr, n, mod):
	p = 1
	for i in arr:
		p *= i
	return p % mod


def product(arr, n, mod):
	m = 1
	for i in arr:
		m = m * i
	return m % mod


def product(arr, n, mod):
	sum = 1
	for i in arr:
		sum *= i
	return sum % mod


def product(arr, n, mod):
	prod = 1
	for i in arr:
		prod *= i
	return prod % mod


def product(arr, n, mod):
	p = 1
	for i in arr:
		p *= i
	return p % mod


def product(arr, n, mod):
	mul = 1
	for i in arr:
		mul *= i
	return mul % mod


def product(arr, n, mod):
	i = 0
	prod = 1
	for i in range(0, n):
		prod = prod * arr[i] % mod
	return prod


def product(arr, n, mod):
	product = 1
	for i in range(n):
		product = product * arr[i]
	return product % mod


def product(arr, n, mod):
	multi = 1
	i = 0
	while i < n:
		multi = multi * arr[i]
		i += 1
	return multi % mod


def product(arr, n, mod):
	f = 1
	for i in arr:
		f *= i
	return f % mod


def product(arr, n, mod):
	mod = 10 ** 9 + 7
	mul = 1
	for i in range(n):
		mul *= arr[i]
	return mul % mod


def product(arr, n, mod):
	c = 1
	for i in arr:
		c = c * i
	return c % mod


def product(arr, n, mod):
	les = 1
	for i in range(len(arr)):
		les *= arr[i]
	return les % mod


def product(arr, n, mod):
	prod = 1
	for num in arr:
		prod *= num
	return prod % mod


def product(arr, n, mod):
	res = 1
	for i in arr:
		res *= i
	return res % mod


def product(arr, n, mod):
	count = 1
	for i in range(0, n):
		count = count * arr[i]
	return int(count % mod)


def product(arr, n, mod):
	prd = 1
	for i in arr:
		prd = prd * i % mod
	return prd


def product(arr, n, mod):
	s = 1
	for i in range(n):
		s = s * arr[i]
	return int(s % mod)


def product(arr, n, mod):
	ans = arr[0]
	for x in range(1, n):
		ans = ans * arr[x]
	return ans % mod


def product(arr, n, mod):
	su = 1
	for i in arr:
		su *= i
	return su % mod


def product(arr, n, mod):
	x = 1
	for i in arr:
		x *= i
	return x % mod


def product(arr, n, mod):
	a = 1
	for i in arr:
		a *= i
	return a % mod


def product(arr, n, mod):
	mod = 1000000007
	mul = 1
	for i in range(n):
		mul *= arr[i]
	return mul % mod


def product(arr, n, mod):
	pro = 1
	for x in range(len(arr)):
		pro = pro * arr[x]
	return pro % mod


def product(arr, n, mod):
	v = 1
	for i in arr:
		v *= i
	return v % mod


def product(arr, n, mod):
	result = 1
	for i in arr:
		result *= i
	return result % mod


def product(arr, n, mod):
	pro = 1
	for i in arr:
		pro *= i
	return pro % mod


def product(arr, n, mod):
	ans = 1
	for i in range(n):
		ans *= arr[i]
	new = ans % mod
	return new


def product(arr, n, mod):
	k = 1
	for e in arr:
		k *= e
	return k % mod