What is considered an "advanced" topic in Python?
Marko Rauhamaa
marko at pacujo.net
Mon Jun 1 06:54:57 EDT 2015
Dave Farrance <DaveFarrance at OMiTTHiSyahooANDTHiS.co.uk>:
>>>> Decimal('0.3')
> Decimal('0.3')
>>>> Decimal(0.3)
> Decimal('0.299999999999999988897769753748434595763683319091796875')
At first I thought I had never dealt with money in Python nor made use
of Decimal. Then I remembered I *did* deal with money in one program and
wondered how I handled it. Sure enough:
newdistr[clubacct] = decimal.Decimal("%.2f" % amount)
Marko
More information about the Python-list
mailing list