+ 1
Switch in Pyhton
Is there a switch in python?
5 Respuestas
+ 3
If you need switch case in python then you can use dictionary for it.i know there is no original switch case in python but mostly people also call dictionary as switch case for python. because it is similar to switch case.
Check this link.
https://youtu.be/gllUwQnYVww
+ 3
Unfortunately not :/
I somewhere read a post on StackOverflow about the reasons and that they considered it, though it's not "pythonic" and using elif doesn't extend the code much.
+ 2
Unfortunately, no. Have a look on StackOverflow, they have some ways to "simulate" a switch statement, but it's not like the switch statement used in JS or C/++.
+ 1
I use a chain of if..elif..else
+ 1
Thanks for the answers. Emulate Switch Case for Functions, incredible.