Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

ternary operator python

# Ternary expression syntax:
# value_if_true if condition else value_if_false
#
# Example:
a = True
b = "yes" if a else "no" # b will be set to "yes"
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #ternary #operator #python
ADD COMMENT
Topic
Name
6+1 =