0

Is there any option for use switch case in python as C , instead of using if-else ladders

Is there any function like switch case in python?

18th Apr 2018, 8:13 AM
PRITAM CHAKRABORTY
PRITAM CHAKRABORTY - avatar
2 Respostas
+ 3
There is no switch in Python. However, there can sometimes be ways to reduce the number of if elif else statements Check out the discussion and codes on this thread. They might help. Also look at the stack overflow link that I added https://stackoverflow.com/questions/17166074/most-efficient-way-of-making-an-if-elif-elif-else-statement-when-the-else-is-don https://www.sololearn.com/Discuss/1219449/?ref=app
18th Apr 2018, 8:22 AM
cyk
cyk - avatar
+ 1
thank you. and you can check my knight. py code...in this code I have reduced if esle statements by using for loop...many others used if els to do the same prblm.
18th Apr 2018, 10:34 AM
PRITAM CHAKRABORTY
PRITAM CHAKRABORTY - avatar