http://www.python.org/doc/current/lib/typesnumeric.html for Documentation
Specifically For (plain or long) integer division, the result is an integer. The result is always rounded towards minus infinity: 1/2 is 0, (-1)/2 is -1, 1/(-2) is -1, and (-1)/(-2) is 0. Note that the result is a long integer if either operand is a long integer, regardless of the numeric value. On Thu, Jul 10, 2008 at 10:24 AM, Gopal Ghosh <[EMAIL PROTECTED]> wrote: > Dear sir / madam > I am a new user of python and this is my first mail to local user group of > python. I came across a strange behavior pf python n unable to explain it > > > ********************* > >>> 7/3 > 2 > >>> 7/-3 > -3 > >>> 3/7 > 0 > >>> # again reapting the questions with one more decimal place > >>> 7.0/3 > 2.3333333333333335 > >>> 7.0/-3 > -2.3333333333333335 > >>> 3.0/7 > 0.42857142857142855 > >>> # why it is not showing the exact values in the previous cases > >>> > ******************************** > ur help will strengthen my love for python > Thanks > Regards > > _______________________________________________ > BangPypers mailing list > [email protected] > http://mail.python.org/mailman/listinfo/bangpypers > >
_______________________________________________ BangPypers mailing list [email protected] http://mail.python.org/mailman/listinfo/bangpypers
