Computer Science, asked by vijaykodipally37361, 11 months ago

Does Python support ""switch"" statements?

Answers

Answered by NehaKari
0

PYTHON DOES NOT SUPPORT SWITCH STATEMENT..........

PYTHON does not support "switch" statement  because :-

  • Nobody has been able to suggest an implementation that works well with Python's syntax and established coding style.
  • Most programming languages have switch/case because they don't have proper mapping constructs. You cannot map a value to a function, that's why they have it.
  • But in Python, you can easily have a mapping table(dict) where a certain value maps to a certain function. Python functions are first class values, you can use the functions as the values of the dictionary get(key[, default]) method. Performance-wise, the Python dictionary lookup will almost certainly be more efficient than any solution.
Answered by gratefuljarette
0

No, python doesn’t support any switch statements.

Explanation:

  • Python is a powerful modern programming language that has so many inbuilt tools and features but it doesn’t support the switch statement.
  • Though we can create the switch statement type cases with the help of the Python dictionary.  We can use the keys of the dictionary present in python to create cases like in switch statements.
  • The dictionary will show the result based on the keys. We can create dynamic actions like cases with the help of a dictionary in python.

Learn more about Python

Write any two features of python that make it user friendly

https://brainly.in/question/9677174

In how many different ways, can you work in python?

https://brainly.in/question/9479066

Similar questions