(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
本文标题:TernaryOperators
本文链接:https://www.haomeiwen.com/subject/vceeiftx.html
网友评论