General way to print floats without the .0 part

You can use the .removesuffix method (Python 3.9+):

>>> str(24.125).removesuffix(".0")
'24.125'
>>> str(25.0).removesuffix(".0")
'25'