10/9/2019 4:28:43 AM
There are no strict alternatives for if elif else statements, such as switch statement which I assume you to have been searching for.
You can get rid of elif by nesting more if else statements within the else but elif helps reduce the levels of nesting.
Depending how complicated your conditions are. You can use a dictionary to drive a condition, where the key is the result of the conditional expression, and the value could even be a function call.
Also you can use map() to transform values.
GET THE FREE APP
Learn Playing. Play Learning
Send us a message