Chris Angelico <ros...@gmail.com> wrote: > On Fri, Sep 7, 2012 at 10:53 PM, Ramyasri Dodla <ramyasr...@gmail.com> wrote: >> I am brand new to python. checking over basic stuff. I came across the >> problem while doing so. If any body aware of the problem, kindly respond me. >> >>>>> 5/10 >> 0 >>>>> - 5/10 >> -1 >> >> The second case also should yield a 'zero' but it is giving a -1 > >
... > The reason for this is that / (or in Python 3, //) rounds toward > negative infinity, not toward zero. This allows the modulo operator I think he means the non-obvious unary minus precedence. -- ----------------------------------------------------------- | Radovan GarabĂk http://kassiopeia.juls.savba.sk/~garabik/ | | __..--^^^--..__ garabik @ kassiopeia.juls.savba.sk | ----------------------------------------------------------- Antivirus alert: file .signature infected by signature virus. Hi! I'm a signature virus! Copy me into your signature file to help me spread! -- http://mail.python.org/mailman/listinfo/python-list