What is the replacement of Switch Case in Python ?
Unlike every other programming language we have used before, Python does not have a switch or case statement. To get around this fact, we use dictionary mapping.
This code is analogous to given code in C++ :
This article is contributed by Shashank Mishra (Gullu). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Python program to convert camel case string to snake case
- Python regex to find sequences of one upper case letter followed by lower case letters
- Python - Convert Snake case to Pascal case
- Python | Switch widget in Kivy
- Python | Switch widget in Kivy using .kv file
- Python | Case Counter in String
- Python | Toggle characters in words having same case
- Python - Case Insensitive Strings Grouping
- Python - Extract Upper Case Characters
- Python - Change Keys Case in Dictionary
- Convert string to title case in Python
- Python - Specific case change in String List
- Python | Convert case of elements in a list of strings
- Python | Ways to sort list of strings in case-insensitive manner
- Python program to count upper and lower case characters without using inbuilt functions
- Tkinter Application to Switch Between Different Page Frames
- Python - Read blob object in python using wand library
- Python | PRAW - Python Reddit API Wrapper
- Important differences between Python 2.x and Python 3.x with examples
- twitter-text-python (ttp) module - Python