Floor value in math operators
David Smith
dns4 at cornell.edu
Wed Apr 8 13:08:32 EDT 2009
Avi wrote:
> Hi,
>
> This will be a very simple question to ask all the awesome programmers
> here:
>
> How can I get answer in in decimals for such a math operator:
>
> 3/2
>
> I get 1. I want to get 1.5
>
> Thanks in advance,
> Avi
I'm going to assume your operands are variables instead of numeric
literals. Why not consider doing a type conversion to float or Decimal
and then perform the division?
--David
More information about the Python-list
mailing list