🔥 Burn Fat Fast. Discover How! 💪

Python 3.10 comes with switch-case (match-case) statements An | DevSchool

Python 3.10 comes with switch-case (match-case) statements

An example:
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"

Related Articles:

Article 1 - https://docs.python.org/3.10/whatsnew/3.10.html#simple-pattern-match-to-a-literal

Article 2 - https://towardsdatascience.com/whats-new-in-python-3-10-a757c6c69342