Python clear solution with Condition
python\nfrom threading import Condition\nclass ZeroEvenOdd:\n    def __init__(self, n):\n        self.n = n\n        self._cv = Condition()\n        self._p = 0
```python\nfrom threading import Condition\nclass ZeroEvenOdd:\n    def __init__(self, n):\n        self.n = n\n        self._cv = Condition()\n        self._p = 0\n\n    def zero(self, printNumber: \'Callable[[int], None]\') -> None:\n        for i in range(self.n):\n            with self._cv:\n                self._cv.wait_for(lambda: self._p == 0)\n                printNumber(0)\n                self._p = 1 if i%2 == 0 else -1\n                self._cv.notify_all()\n        \n    def even(self, printNumber: \'Callable[[int], None]\') -> None:\n        for i in range(2, self.n+1, 2):\n            with self._cv:\n                self._cv.wait_for(lambda: self._p == -1)\n                printNumber(i)\n                self._p = 0\n                self._cv.notify_all()\n        \n    def odd(self, printNumber: \'Callable[[int], None]\') -> None:\n        for i in range(1, self.n+1, 2):\n            with self._cv:\n                self._cv.wait_for(lambda: self._p == 1)\n                printNumber(i)\n                self._p = 0\n                self._cv.notify_all()\n```
[]