Is there a switch or case statement in python? If not then what is the reason for the same?
Answer / Shweta Sharma
No, Python does not have a switch or case statement. Instead, it uses if-elif-else statements for conditional execution. The reasoning behind this is that the if-elif-else structure in Python is more flexible and easy to understand, making the code easier to read and maintain.
| Is This Answer Correct ? | 0 Yes | 0 No |
How can you pick a random item from a list or tuple in python?
What does ord () do in python?
Which is the invalid variable assignment from the below?
How do you check whether the two variables are pointing to the same object in python?
Does return end a function python?
Does python allow you to program in a structured style?
How would you define a block in python?
Why python is used?
What is the purpose of self?
How do you extend in python?
What language is python based on?
What is setuptools in python?