Python solution easy-understanding with explanation
class ProductOfNumbers:\n\n    def init(self): #adding one dummy element at the begining \n        self.l = [1]\n\n    def add(self, num: int) -> None: # if num
class ProductOfNumbers:\n\n    def __init__(self): #adding one dummy element at the begining \n        self.l = [1]\n\n    def add(self, num: int) -> None: # if num is equal to zero, all the product starting from num will also be zero\n        if num == 0: # no need to record the previous zero\n            self.l = [1]\n        else:\n            self.l.append(num*self.l[-1])\n        return \n    def getProduct(self, k: int) -> int:\n        length = len(self.l) \n        if k<length: #if means no zero is included\n            return self.l[length-1]//self.l[length-1-k]\n        return 0 # at least one zero is included
['Python']