我正在尝试向计算器脚本添加一些逻辑,我想在其中“分组”一些变量。逻辑是这样的:
apples = raw_input("How many apples do you have?:")
oranges = raw_input("How many oranges do you have?:")
pears = raw_input("How many pears do you have?:")
if anyone of these three == 0:
print "So you got xx %s and xx %s" % (intthatdidntget0, int2thatdidntget0)
如果这三个中的任何一个得到值“0”,我想从我的下一次计算中排除该变量。我可以为每个组合做 if/else 语句,但这感觉不是很有效。