Python Switch Case 3.10 Dopasowanie wzoru strukturalnego
#From python 3.10 on, pattern matchin (switch case) has been added
def http_error(status):
match status:
case 400:
return "Bad request"
case 404:
return "Not found"
case 418:
return "I'm a teapot"
case 401|403|404:
return "Not allowed"
case _:
return "Something's wrong with the internet"
#Source: https://docs.python.org/3/whatsnew/3.10.html
Motionless Macaw