Answers for "match statement"

0

match statement

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"
Posted by: Guest on October-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language