2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by dineshswamy
0
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=[3], 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, //

32//10

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:
http://docs.python.org/release/2.2.3/whatsnew/node7.html
or
http://docs.python.org/reference/expressions.html

Edited by Lucaci Andrew: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.