- Code: Select all
rain = indigo.variables[1938961] #rain in mm
inches = "{:.2f}".format(float(rain.value) *.03937) #coverts mm to inches
indigo.variable.updateValue(1852577407, inches) #inserts inches into variable
- Code: Select all
"{:.2f}"
https://python.shiksha/tips/limiting-float-upto-2-places/
but can't figure out where some of this should go in my equation. I even tried reformatting the calculation result before it is written to the variable, but again, had no luck, so I'm hoping there is a way to limit the calculation to just 2 decimal places.