擅长:python、mysql、java
<p>我可以建议,如果你使用整数,你应该返回一个整数,而不是浮点数(如果我理解你的意图的话)</p>
<p><code>##randtst.write(str(total / 10)+"\n")</code>原件</p>
<p><code>##randtst.write(str(total // 10)+"\n")</code></p>
<p>使用楼层分隔符而不是分隔符可以将数字四舍五入为整数,这更符合您的意图</p>
<p>如果您使用的是浮点数,可能会使用%来代替。这不仅会除以数字,而且只返回余数</p>
<p><code>%</code>在python中是模</p>
<p><code>//</code>是python中的楼层划分</p>
<p>如果总数返回一个浮点整数,这些符号将使数字保持稳定并更易于操作</p>
<p>如果不是这样的话,你就必须计算出小数点后面的每一个数字</p>
<p>如果是这种情况,你的结果将永远不会达到10x^6,因为求和你的值的那一行被卡在了一个循环中</p>
<p>我希望这对您有所帮助,如果没有,请告诉我,因为我也在学习python</p>