unsupported operand type(s) for *: 'float' and 'Decimal'

前端 未结 2 684
遇见更好的自我
遇见更好的自我 2021-02-04 23:30

I\'m just playing around learning classes functions etc, So I decided to create a simple function what should give me tax amount.

this is my code so far.



        
2条回答
  •  误落风尘
    2021-02-05 00:03

    It seems like self.VAT is of decimal.Decimal type and self.amount is a float, thing that you can't do.

    Try decimal.Decimal(self.amount) * self.VAT instead.

提交回复
热议问题