Answer Posted / chaitanya
The ternary operator is the operator that is used to show the conditional statements. This consists of the true or false values with a statement that has to be evaluated for it. The operator will be given as:
[on_true] if [expression] else [on_false]
x, y = 25, 50
big = x if x < y else y
This is the lowest priority operator that is used in making a decision that is based on the values of true or false. The expression gets evaluated like if x<y else y, in this case if x<y is true then the value is returned as big=x and if it is incorrect then big=y will be sent as a result.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is python metaclass?
What is a python mixin?
What is encapsulation in python?
Which gui is best for python?
How do you call functions in python?
Is python or r more useful?
Is there a tool to help find bugs or perform static analysis?
Explain the difference between append vs extend in list?
What is mro in python?
What are the programming-language features of python?
Explain about the use of python for web programming?
How do you split a list into evenly sized chunks?
What is python orm?
How will you capitalize the first letter of string?
What does “list comprehension” mean? How does it work and how can I use it?