# 三元条件运算,如果条件为真则返回x,如果条件为假则返回y x = 3 y = 5 ret = x if x > y else y print(ret) # 返回 y值
ret = [i for i in range(5)] print(ret)
ret = [i for i in range(5) if i == 3] print(ret)