I take it that you are using python3.x rather than python2.x.
In python 2.x, the expression 100/25 is the integer 4
In python 3.x, the expression 100/25 is 4.0
And as someone already pointed out mixing Decimal and float doesn't work.
Try replacing the 100 / 4 with one of int(100/4) or (100//4) (y
Shawn Milochik wrote:
It doesn't work because an instance of the Decimal object can't be used for
mathematical calculations (such as division and multiplication) with floats or
integers.
AFAIK decimals can be divided and multiplied with integers just fine.
They throw an "unsupported operand"
It doesn't work because an instance of the Decimal object can't be used for
mathematical calculations (such as division and multiplication) with floats or
integers.
If you replace this:
100 / 25
with:
Decimal(str(100 / 25))
or:
Decimal("4")
It should work.
Shawn
--
You received this m
This is kinda of a general and kind of a specific question. I have
this in my view:
http://dpaste.com/154208/
The first line adds up perfectly, but the second one doesn't and
throws an index out of range error.
What is the problem?
cog.interview_score and cog.interview_score_conv are both
Decim
4 matches
Mail list logo