Easy || PYTHON SOLUTION
\nfrom threading import Semaphore\n\nclass DiningPhilosophers:\n    def __init__(self):\n        self.sizelock = Semaphore(4)\n        self.locks = [Semaphore(1
```\nfrom threading import Semaphore\n\nclass DiningPhilosophers:\n    def __init__(self):\n        self.sizelock = Semaphore(4)\n        self.locks = [Semaphore(1) for _ in range(5)]\n\n    def wantsToEat(self, index, *actions):\n        left, right = index, (index - 1) % 5\n        with self.sizelock:\n            with self.locks[left], self.locks[right]:\n                for action in actions:\n                    action()\n```
['Python']