python 3 locks
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimport threading\nclass ZeroEvenOdd:\n    def __init__(self, n):\n        self.n = n\n        self.current = 1\n        \n        self.even_lock = threading.Lock()\n        self.odd_lock = threading.Lock()\n        self.zero_lock = threading.Lock()\n\n        self.even_lock.acquire()\n        self.odd_lock.acquire()\n\n        \n\t# printNumber(x) outputs "x", where x is an integer.\n    def zero(self, printNumber: \'Callable[[int], None]\') -> None:\n        for _ in range(self.n):\n            self.zero_lock.acquire()\n            printNumber(0)\n            if self.current % 2 == 0:\n                self.even_lock.release()\n            else:\n                self.odd_lock.release()\n\n        \n    def even(self, printNumber: \'Callable[[int], None]\') -> None:\n        for _ in range(2, self.n + 1, 2):\n            self.even_lock.acquire()\n            printNumber(self.current)\n            self.current += 1\n            self.zero_lock.release()\n        \n        \n    def odd(self, printNumber: \'Callable[[int], None]\') -> None:\n        for _ in range(1, self.n + 1, 2):\n            self.odd_lock.acquire()\n            printNumber(self.current)\n            self.current += 1\n            self.zero_lock.release()\n        \n```
['Python3']