# Introduction and Warm-up (Highly recommended)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)
___

# Task

**_Given_** an *array/list [] of integers* , **_Construct_** a *product array **_Of same size_** Such That prod[i] is equal to The Product of all the elements of Arr[] except Arr[i]*. 
___

# Notes 


* **_Array/list_** size is *at least 2* .

* **_Array/list's numbers_**  Will be **_only Positives_** 

* **_Repetition_** of numbers in *the array/list could occur*.
___

# Input >> Output Examples 

```
productArray ({12,20}) ==>  return {20,12}
```
## **_Explanation_**:

* **_The first element_**  *in prod [] array* **_12_**  *is the product of all array's elements except the first element*

* **_The second element_** **_20_**  *is the product of all array's elements except the second element* .
___

```
productArray ({1,5,2}) ==> return {10,2,5}
```

## **_Explanation_**: 


* **_The first element_**  **_10_** *is the product of all array's elements* **_except_** *the first element **_1_***

* **_The second element_** **_2_** *is the product of all array's elements* **_except_** *the second element* **_5_** 

* **_The Third element_** **_5_** *is the product of all array's elements* **_except_** *the Third element* **_2_**.

___

```
productArray ({10,3,5,6,2}) return ==> {180,600,360,300,900}
```

## **_Explanation_**: 


* **_The first element_** **_180_**  *is the product of all array's elements* **_except_** *the first element*  **_10_** 

* **_The second element_** **_600_** *is the product of all array's elements*  **_except_**  *the second element*  **_3_** 

* **_The Third element_** **_360_** *is the product of all array's elements* **_except_** *the third element* **_5_**

* **_The Fourth element_** **_300_** *is the product of all array's elements* **_except_** *the fourth element* **_6_** 

* *Finally* ,**_The Fifth element_** **_900_** *is the product of all array's elements* **_except_** *the fifth element* **_2_** 

___
# [A more challenging version of this kata by Firefly2002](https://www.codewars.com/kata/array-product-sans-n)
___
___

# [Playing with Numbers Series](https://www.codewars.com/collections/playing-with-numbers)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)

# [For More Enjoyable Katas](http://www.codewars.com/users/MrZizoScream/authored)
___

## ALL translations are welcomed

## Enjoy Learning !!
# Zizou

Difficulty: EASY
Tags: Fundamentals

Data structures
Skill types: Data structures

Starter code:
def product_array(numbers):
	

Solutions:
from operator import mul
from functools import reduce

def product_array(numbers):
	tot = reduce(mul, numbers)
	return [tot // n for n in numbers]


from numpy import prod

def product_array(numbers):
	p = prod(numbers)
	return [p // i for i in numbers]


def product_array(numbers):
	prod = eval('*'.join(map(str, numbers)))
	return [prod / x for x in numbers]


from functools import reduce

def product_array(l):
	return [reduce(lambda p, n: p * n, l, 1) / n for n in l]


def product_array(n):
	prod = eval('*'.join(map(str, n)))
	return [prod // i for i in n]


from functools import reduce

def product_array(num):
	s = reduce(int.__mul__, num)
	return [s / i for i in num]


from functools import reduce

def product_array(numbers):
	r = lambda x, y: x * y
	return [reduce(r, (x for (i, x) in enumerate(numbers) if i != index)) for index in range(len(numbers))]


import functools

def product_array(n):
	return [functools.reduce(lambda a, b: a * b, n) // x for x in n]