I need to return a number (not a string!) that always has 2 decimal places, regardless of what number I enter. For example:
86
returns86.00
3.12345
returns3.12
2.0
returns2.00
The problem is that if I use the Python's decimal module, it returns Decimal('#')
, instead of just #
(I want only the number). If I instead use "%.2f" % #
, it returns the number as a string, which is not what I want as I can't do any math operations on strings in Python.