Ternary Operator in Python
This is the short hand name of if - else
. It is also know as conditional operator. Its allow to test the condition in single line.
Syntax :-
[on_true] if [expression] else [on_false]
Example :-
Output :-
I hope you understand the concept of ternary operator in python. If you have any suggestion or query please do a comment.
Thank You.
Comments
Post a Comment