How do I get a decimal value when using the division operator in Python?
There are three options: >>> 4 / float(100) 0.04 >>> 4 / 100.0 0.04 which is the same behavior as the C, C++, Java etc, or >>> from __future__ import division >>> 4 / 100 0.04 You can also activate this behavior by passing the argument -Qnew to the Python interpreter: $ python -Qnew >>> … Read more