how can i calculate float value?
eg it is 32/10 3.2 in calculator
in python 32/10 is 3.0
help me out
from __future__ import division print 32/10 """ My output: 3.2 """
Basically, the from __future__ import division, will convert the / operator into the floor division operator, which will do the exact division.
Note that if you do such thing, the / operator which was before, meaning 32/10=, the real part of the number, will be changed to the floor division operator, and its effect will last throughout all script.
Another way is to use the double div operator, //
but I'm not that sure it will work, heh :D, gotta try:P
Later edit: Apparently the // ain't working for me...
You can get further help at this websites:
thankyou ,32//10 is not working