✅ Beginner Friendly | Simple Python Solution 💡| Theory Explained
Code
# Code
```python3 []
class ProductOfNumbers:

    def __init__(self):
        self.prefix = [1]  # Prefix product list (1-based for easier division)

    def add(self, num: int) -> None:
        if num == 0:
            # Reset when a zero is added
            self.prefix = [1]
        else:
            self.prefix.append(self.prefix[-1] * num)  # Store cumulative product

    def getProduct(self, k: int) -> int:
        if k >= len(self.prefix):  # If k exceeds available elements, return 0
            return 0
        return self.prefix[-1] // self.prefix[-(k+1)]

```
['Array', 'Math', 'Data Stream', 'Prefix Sum', 'Python3']