Challenge: List of Products of all Elements

Given a list, modify it so that each index stores the product of all elements in the list except the element at the index itself.

Problem Statement

Implement a function, find_product(lst), which modifies a list so that each index has a product of all the numbers present in the list except the number stored at that index.

Input:

A list of numbers (could be floating points or integers)

Output:

A list such that each index has a product of all the numbers in the list except the number stored at that index.

Sample Input

arr = [1,2,3,4]

Sample Output

arr = [24,12,8,6]

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.