Is there a reason python does not have a statement like switch or case? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there a reason python does not have a statement like switch or case?

I miss the switch or case statement like in many other languages. Now you have use the if... elif....elif... else construction.

16th Nov 2016, 7:17 PM
John van der Vuurst
John van der Vuurst - avatar
2 Answers
+ 2
Python has if and elif which is identified with if and else if but it is much like the switch case and basically eliminates the need for one. I thought the same thing at first, but I have used the if/elif as effectively as I could a switch statement.
16th Nov 2016, 7:20 PM
NICKALL [EP]
NICKALL [EP] - avatar
0
John you work as a coder for your profession?
10th Dec 2016, 12:22 AM
Chris Welham
Chris Welham - avatar