python math.floor()

在python2中除是没有小数的除
在python3里面除是有小数的除,所以需要使用math.floor()

Python 2.7.10 (default, Oct  6 2017, 22:29:07) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 3/2
1
>>> 
Python 3.7.0 (default, Jun 29 2018, 20:13:13) 
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 3/2
1.5
>>> 

你可能感兴趣的:(python math.floor())