2 ответов
+ 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
+ 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.