<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 2011/06/07 04:43 AM, Michael bridges wrote:
    <blockquote cite="mid:981702.91185.qm@web161312.mail.bf1.yahoo.com"
      type="cite">
      <pre wrap="">i saw it somewhere, but where?

i want to 10 / 1000 and get 0.01 not 0
if 1000 is made 1000.00 then 0.01 is printed
but that gives 500 / 1000.00 is 0.5 not 0.50

i might be thinking C# not python.

can someone till me how to get a two decimal precision every time?

_______________________________________________
Tutor maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
To unsubscribe or change subscription options:
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>

</pre>
    </blockquote>
    <br>
    <tt>&gt;&gt;&gt; 100/1000<br>
      0<br>
      &gt;&gt;&gt; from __future__ import division<br>
      &gt;&gt;&gt; 100/1000<br>
      0.1<br>
      &gt;&gt;&gt; 100//1000<br>
      0<br>
      <br>
      So you can still get the old behaving floor division using double
      divisors and any normal syntax will be true division. In Python
      3.x it's already the standard, this is only necessary for Python
      2.x<br>
    </tt><br>
    <div class="moz-signature">-- <br>
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <title>Email Signature</title>
      <style type="text/css">
p { font-size:8.5pt; font-family: Arial, Helvetica, sans-serif; color: #000;}
.subscribe {font-weight:bold; font-style:italic;}
.compuscan {color: #c60c30; letter-spacing:2px; text-transform:uppercase; font-weight:bold}
.green {color:#093;}
</style>
      <p>Christian Witts<br>
        <br>
        <em class="green"></em></p>
    </div>
  </body>
</html>