“Python Switch Case 3.10” Kode Jawaban

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")
Wissam

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
Frustrated Developer

Jawaban yang mirip dengan “Python Switch Case 3.10”

Pertanyaan yang mirip dengan “Python Switch Case 3.10”

Lebih banyak jawaban terkait untuk “Python Switch Case 3.10” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya