Round a decimal number

Skip Montanaro skip at pobox.com
Thu May 29 16:14:24 EDT 2003


    manuel> How I can round a decimal number?
    manuel> Example: 1.4463784692425  to 1.45

Many people find the builtin round() function useful for this:

    >>> round(1.4463784692425, 2)
    1.45

:-)

Skip





More information about the Python-list mailing list