What is the Python equivalent for a case/switch statement? [duplicate]

Python 3.10 and above In Python 3.10, they introduced the pattern matching. Example from the Python documentation: def http_error(status): match status: case 400: return “Bad request” case 404: return “Not found” case 418: return “I’m a teapot” # If an exact match is not confirmed, this last case will be used if provided case _: … Read more