Basic implementation using match and case | Python
Match-Case was released in the Python 3.10 release. This allows users to replace if elif with match case.\n\nCode using if else:\n\nx = 5\nif x > 0:\n    print(
Match-Case was released in the Python 3.10 release. This allows users to replace `if elif` with `match case`.\n\nCode using **if else**:\n```\nx = 5\nif x > 0:\n    print("x is positive")\nelse:\n    print("x is not positive")\n```\n\nCode using **match case**:\n```\nx = 5\nmatch x:\n    case _ if x > 0:\n        print("x is positive")\n    case _:\n        print("x is not positive")\n```\n\n# Code\n```\nclass ParkingSystem:\n\n    def __init__(self, big: int, medium: int, small: int):\n        self.big = big\n        self.medium = medium\n        self.small = small\n        \n\n    def addCar(self, carType: int) -> bool:\n\n        match carType:\n            case 1:\n                if self.big:\n                    self.big -= 1\n                    return True\n            case 2:\n                if self.medium:\n                    self.medium -= 1\n                    return True\n            case 3:\n                if self.small:\n                    self.small -= 1\n                    return True\n\n        return False\n```\n![ezgif.com-optimize.gif](https://assets.leetcode.com/users/images/664b617e-1af5-474d-b794-59d6f6fd3142_1686346165.1823967.gif)\n\n
['Python3']