Lambda实现if...elif...else【三元表达式】

fun3= lambda x: print('A',x) if x<10 else (print('B',x) if x==10 else print('C',x))

fun3(11)


if not float(first_list[rank_to_compare]):
    increase_or_decrease = float(second_list[rank_to_compare])/float(first_list[rank_to_compare])-1
    second_list[rank_to_add_flag] = increase_flag + second_list[rank_to_add_flag] 
        if increase_or_decrease > threshold else (decrease_flag + second_list[rank_to_add_flag]
        if increase_or_decrease < -threshold else second_list[rank_to_add_flag])
原文地址:https://www.cnblogs.com/amize/p/14821879.html