Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python ternary

a = 1
b = 2

1 if a > b else -1 
# Output is -1

1 if a > b else -1 if a < b else 0
# Output is -1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #ternary
ADD COMMENT
Topic
Name
7+5 =