0
Q:

python turnary

# Program to demonstrate conditional operator 
a, b = 10, 20
# Copy value of a in min if a < b else copy b 
min = a if a < b else b 
12
a, b = 10, 20
# Copy value of a in min if a < b else copy b 
min = a if a < b else b 
1
is_nice = True
state = "nice" if is_nice else "not nice"
0
(if_test_is_false, if_test_is_true)[test]
0

Tags

New to Communities?

Join the community