Solve the “product of array except self” problem: replace each element with the product of all other elements.
Implement product_except_self(nums), returning a list where index i contains the product of every value in nums except nums[i]. Do not use division. The result array does not count toward extra space, and the input list may contain zeros and negative values.
Input: A list of integers nums.
Output: A list of integers with the same length as nums.
Constraints: 2 <= len(nums) <= 10^4; values may be negative, zero, or positive.
def product_except_self(nums):