3 Antworten
+ 8
No switch case in python
But here are some links that might inspire you
https://stackoverflow.com/questions/21962763/using-a-dictionary-as-a-switch-statement-in-python
https://jaxenter.com/implement-switch-case-statement-python-138315.html
https://www.pydanny.com/why-doesnt-python-have-switch-case.html
+ 2
Ha yes there is an alternative for swich case,,,,you can use "while for condition statement(switch),and use if,elif statements for case(labels in switch),at the end use else statement for default (default statement in switch),,,,
0
Rishabh Sikarwar ,
Python 3.10 added the match case syntax.
Sololearn still uses Python 3.9.16.
https://peps.python.org/pep-0636/