```
class Solution:
# @param {integer[]} nums
# @return {integer[]}
def productExceptSelf(self, nums):
t = 1
zero = 0
for i in nums:
if i : t = t*i
else : zero =zero+1
# if one zero, every thing is zero except for zero itself
if zero is 1 : return [0 if i else t for i in nums ]
# if two or more zero, every thing is zero
if zero > 1 : return [0 for i in nums ]
# if no zero, do the regular calculation
return [t/i for i in nums ]
```