Representing Rational Numbers With Python Fractions
The fractions module in Python is arguably one of the most underused elements of the standard library. Even though it may not be well-known, it’s a useful tool to have under your belt because it can help address the shortcomings of floating-point arithmetic in binary. That’s essential if you plan to work with financial data or if you require infinite precision for your calculations. Towards the end of this tutorial, you’ll see a few hands-on examples where fractions are the […]
Read more