Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

is there a replacement for ternary operator in python

>>> a = 10
>>> b = 5
>>> largest = (b, a)[a > b]
>>> print(largest)
Source by techvidvan.com #
 
PREVIOUS NEXT
Tagged: #replacement #ternary #operator #python
ADD COMMENT
Topic
Name
4+8 =