Skip to content

Instantly share code, notes, and snippets.


Silviu Tantos razius

View GitHub Profile
razius /
Created Jan 19, 2016 — forked from jackiekazil/
How do I round to 2 decimals in python?

How do I round to 2 decimals?

In python, you have floats and decimals that can be rounded. If you care about the accuracy of rounding, use decimal type. If you use floats, you will have issues with accuracy.

All the examples use demical types, except for the original value, which is automatically casted as a float.

To set the context of what we are working with, let's start with an original value.

Original Value

You can’t perform that action at this time.