Explain the use of ternary operator in python?
Answer / Sumit Rawat
The ternary operator, also known as conditional expression, is a shorthand for if-else statement in Python. It consists of three parts: an expression (test), a value to be returned when the test is true (then), and another value to be returned when the test is false (else). The syntax is as follows: `value_if_true if condition else value_if_false`
| Is This Answer Correct ? | 0 Yes | 0 No |
What do you understand by membership operators in python?
What is string slicing in python?
How do you insert a line break in python?
What are the 3 types of numbers in python?
Mention at least 3-4 benefits of using python over the other scripting languages such as javascript.
How to count the occurrences of a perticular element in the list?
What are the 5 tuples?
What is the directory in python?
What is *args and **kwargs?
Who created the Python programming language?
Will python work multiple inheritance?
How to get class name of an instance in Python?