Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Get the product of all numbers other than self in an array.
- def advProductOfTheOthers(arr):
- product = 1
- product_arr = []
- for i in range(0,len(arr)):
- for n in arr:
- if n != arr[i]:
- product *= n
- product_arr.append(product)
- product = 1
- return product_arr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement