Switch Case in Python

What about Switch and Case in Python?

Yes, we don’t have Switch Case in Python.
A ‘switch’ and ‘case’ statement is a powerful programming language feature: It allow us to you control the flow of the program, in a similar manner to the ‘if’ statement, based on the value of a variable passed by.

A ‘switch’ and ‘case’ statements, many times makes your code very readable. See an example of switch statement in Java:

Back to Python, we can do the same using the ‘if’ statement:

Or we can make use of a Dictionary, in our own fancy way:

Notes: Used Python 3 and Java 8 for this example.

That’s it!
Good luck, Bye…