Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

case in python

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"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #case #python
ADD COMMENT
Topic
Name
1+3 =