Python3 prefix product - Product of the Last K Numbers
\nclass ProductOfNumbers:\n\n    def __init__(self):\n        self.preprod = [1]\n\n    def add(self, num: int) -> None:\n        if not num:\n            self.
```\nclass ProductOfNumbers:\n\n    def __init__(self):\n        self.preprod = [1]\n\n    def add(self, num: int) -> None:\n        if not num:\n            self.preprod = [1]\n        else:\n            self.preprod.append(self.preprod[-1] * num)\n\n    def getProduct(self, k: int) -> int:\n        if k >= len(self.preprod):\n            return 0\n        return self.preprod[-1] // self.preprod[-k-1]\n```
['Python', 'Python3']