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? What are the benefits of using python?
Is set ordered in python?
Name few python checkers for debugging?
What is the use of python interpreter?
What are the features of python?
Write a program to reverse the string?
Tell me what is docstring in python?
Explain how you can minimize the memcached server outages in your python development?
Is python good for oop?
Does python has private keyword in python ? How to make any variable private in python ?
How do you count loops in python?
How does mro work in python?
Why is it important?
Is tensorflow written in python?
Explain me what is python and explain some of its benefits?