Learning Scientific Programming with Python (2nd edition)

P2.4.1: Product of all but one integers in a list

Question P2.4.1

Write a short Python program which, given an list of integers, a, calculates a list of the same length, p, in which p[i] is the product of all the integers in a except a[i]. So, for example, if a = [1,2,3], then p is [6, 3, 2].