I need to round a float to be displayed in a UI. e.g, to one significant figure: Is there a nice way to do this using the Python library, or do I have to write it myself? Answer You can use negative numbers to round integers: Thus if you need only most significant digit: You’ll probably have to take care