Python 2.7分区意外结果

时间:2019-02-25 19:24:55

标签: python python-2.7

我正在使用添加了from __future__ import division的python 2。

我有以下变量count = 865total = 1060

使用变量count/total时得到1.2254335260115607

但是我预期的865/1060输出不会导致0.8160377358490566

有人可以帮助我了解我看到的这种行为以及如何将其纠正为0.8160377358490566的预期结果吗?谢谢。

1 个答案:

答案 0 :(得分:1)

似乎您为变量分配了错误,并根据结果偶然地将总数除以计数

相关问题