0

How to implement switch case statement in Python?

11th Apr 2019, 3:08 PM
Branislav
Branislav - avatar
4 Answers
0
Thanks for the answer HonFu. Most of the answers are that there is no switch statement in Python which I know. What I can see is that you can use dictionary or case of functions and here is another question "Which of those approaches is better?"
11th Apr 2019, 3:41 PM
Branislav
Branislav - avatar
0
Branislav , Python 3.10 added the match case syntax. Sololearn still uses Python 3.9.16 though. Other playgrounds have later Python versions if you search for them. Here's the official tutorial. https://peps.python.org/pep-0636/
14th Nov 2023, 2:17 AM
Rain
Rain - avatar