我一直在尝试执行以下代码:
m = [True, True, True, True, False, True, False, True, False, False, True, True, True, True, True, True, True, False, True, False, False, True, True]
count_of_true = 0
total = len(m)
for i in m:
if i is True:
count_of_true += 1
fraction = count_of_true / total
print fraction
分数的值应该是0.77,但它会返回
0
我真的不知道为什么?