TernaryOperators
2018-08-22 本文已影响7人
孟轲666
(if_test_is_false, if_test_is_true)[test]
Example:
fat = True
fitness = ("skinny", "fat")[fat] print("Ali is ", fitness)
# Output: Ali is fat
(if_test_is_false, if_test_is_true)[test]
fat = True
fitness = ("skinny", "fat")[fat] print("Ali is ", fitness)
# Output: Ali is fat