ming_piao= 11
ming_yeji= 586319
ming_age= 34
ming_gongling= 10
ming_yanjiang= 81

qiang_piao= 7
qiang_yeji= 811064
qiang_age= 27
qiang_gongling= 4
qiang_yanjiang= 83

ming_piao_fen= ming_piao*3
ming_yeji_fen= ming_yeji//20000
ming_age_fen= (ming_age<qiang_age)*(qiang_age - ming_age)*2
ming_gongling_fen= (ming_gongling>qiang_gongling)*(ming_gongling-qiang_gongling)*5
ming_yanjiang_fen= ming_yanjiang

qiang_piao_fen= qiang_piao*3
qiang_yeji_fen= qiang_yeji//20000
qiang_age_fen= (qiang_age<ming_age)*(ming_age-qiang_age)*2
qiang_gongling_fen= (qiang_gongling>ming_gongling)*(qiang_gongling-ming_gongling)*5
qiang_yanjiang_fen= qiang_yanjiang

ming_fen=ming_piao_fen+ming_yeji_fen+ming_age_fen+ming_gongling_fen+ming_yanjiang_fen
qiang_fen=qiang_piao_fen+qiang_yeji_fen+qiang_age_fen+qiang_gongling_fen+qiang_yanjiang_fen

is_ming=ming_fen>qiang_fen
is_qiang=not is_ming

print("小明"+str(is_ming*"成为副经理")+str((not is_ming)*"不能成为副经理"))
print("小强"+str(is_qiang*"成为副经理")+str((not is_qiang)*"不能成为副经理"))

布尔值*字符串可以通过,大概是ASCII码的缘故

04-10 01:17