Advertisement
Guest User

Untitled

a guest
May 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. Get the product of all numbers other than self in an array.
  2.  
  3. def advProductOfTheOthers(arr):
  4. product = 1
  5.  
  6. product_arr = []
  7. for i in range(0,len(arr)):
  8. for n in arr:
  9.  
  10. if n != arr[i]:
  11. product *= n
  12. product_arr.append(product)
  13. product = 1
  14. return product_arr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement