Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python switch case 3.10

grade = 92
category = grade//10  # Well above average grade
match category:
	case 10:
		print("Excellent")
	case 9:
		print("Well above average")
	case 8:
		print("Above average")
	case 7:
		print("Average")
	case 6:
		print("Below average")
	case _:
		print("Not passing")
Comment

switch case python 3.10

def my_function(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"

# No need of break after case
Comment

PREVIOUS NEXT
Code Example
Python :: python generator comprehension 
Python :: get page title by python bs4 
Python :: python update 
Python :: how to check for missing values in pandas 
Python :: create app in django 
Python :: python dataframe replace nan with 0 
Python :: python import from parent directory 
Python :: python exam questions pdf 
Python :: whatsapp online tracker python script 
Python :: binary to decimal conversion python 
Python :: python map string to int 
Python :: how to use h5 file in python 
Python :: copy file python 
Python :: initialise a 2d array python 
Python :: good python ide 
Python :: python obfuscator 
Python :: cross join pandas 
Python :: button in python 
Python :: python replace two spaces with one 
Python :: pandas drop if present 
Python :: __new__ python 
Python :: python loop go back to start 
Python :: scikit learn pca 
Python :: Python code for checking if a number is a prime number 
Python :: To visualize the correlation between any two columns | scatter plot graph 
Python :: asymmetric encryption python 
Python :: how to make lists in python 
Python :: python pandas column where 
Python :: c++ vs python 
Python :: process rows of dataframe in parallel 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =