我正在尝试使用带有“and”的 if 函数。它不起作用 - 有更好的方法或更好的命令吗?这是我的代码示例:
if measure >= 4.52 and <= 4.58:
optimal += measure
total += measure
count += 1
elif measure >= 4.50 and <= 4.60:
allowed += measure
total += measure
count += 1
else:
faulty += measure
total += measure
count += 1
感谢帮助!
你需要measure
在你的if
条件下重复。像这样:
if measure >= 4.52 and measure <= 4.58:
optimal += measure
total += measure
count += 1
elif measure >= 4.50 and measure <= 4.60:
allowed += measure
total += measure
count += 1
else:
faulty += measure
total += measure
count += 1
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句