Why Having a Switch/Case in Python Would Be Useful

Give Feedback

In this lesson, you’ll see why having switch/case in Python would be useful. Python does not have a switch/case statement and because of this, many Python developers useif statements to decide on what action to take based on a condition:

if cond == 'cond_a':
elif cond == 'cond_b':

This lesson will go over some of the problems of using this approach.

Comments & Discussion

Become a Member to join the conversation.