python switch

def http_error(status):
    match status:
        case 400:
            return "Bad request"
        case 404:
            return "Not found"
        case 418:
            return "I'm a teapot"
        case _:
            return "Something's wrong with the internet"

Here is what the above code is Doing:
1. It’s defining a function called http_error.
2. It’s taking a single argument, status.
3. It’s using pattern matching to match the status argument against a series of cases.
4. If the status argument is 400, it returns “Bad request”.
5. If the status argument is 404, it returns “Not found”.
6. If the status argument is 418, it returns “I’m a teapot”.
7. If the status argument is anything else, it returns “Something’s wrong with the internet”.