ptn <[EMAIL PROTECTED]> wrote: > PASCAL --> PYTHON > 5 div 2 --> 5/2 better: 5//2
The behaviour of 5/2 varies according to command line options and/or __future__ imports. e.g. If you start Python with the -Qwarn option 5/2 will generate a warning; if you start Python with -Qnew (or use "from __future__ import division") then 5/2 will give you 2.5. It is best, if you mean integer division, to always use the integer division operator. > 5 mod 2 --> 5 % 2 > 5/2 --> 5/2. (Notice the little dot at the end) Also note that those relationships only hold where both operands are positive. Python: -3//2 ---> -2 Pascal: -3 div 2 ---> either -1 or -2 is allowed by the standard. Python: 3 % -2 ---> -1 Pascal: 3 mod -2 --> error -- http://mail.python.org/mailman/listinfo/python-list