0
How to implement switch case statement in Python?
4 Respuestas
+ 2
https://www.sololearn.com/discuss/1751803/?ref=app
https://www.sololearn.com/discuss/139942/?ref=app
https://www.sololearn.com/discuss/742222/?ref=app
https://www.sololearn.com/discuss/17832/?ref=app
https://www.sololearn.com/discuss/1598161/?ref=app
https://www.sololearn.com/discuss/1018886/?ref=app
https://www.sololearn.com/discuss/227306/?ref=app
https://www.sololearn.com/discuss/48633/?ref=app
https://www.sololearn.com/discuss/1586260/?ref=app
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?"
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/