我对python非常陌生,正在寻找简化以下内容的方法:
if atotal == ainitial:
print: "The population of A has not changed"
if btotal == binitial:
print: "The population of B has not changed"
if ctotal == cinitial:
print: "The population of C has not changed"
if dtotal == dinitial:
print: "The population of D has not changed"
很明显,_total和_initial是预定义的。 提前谢谢你的帮助。在
使用有序字典的另一种方法(2.7):
您可以将所有对组织到字典中,并循环使用所有元素:
您可以使用两个词典:
一种类似的方法是首先确定未发生变化的人群:
^{pr2}$或者,您可以有一个单一的结构:
^{3}$相关问题 更多 >
编程相关推荐