### Simple Rounding Question

Posted:

**Mon Jun 10, 2019 8:27 pm**I'm keeping tabs on something that outputs in seconds... but there are thousands of them, so the number is meaningless. I'm trying to get the seconds converted to hours, which I've been able to do, but would like to keep the answer to 2 decimal places.

Here is my original code:

and this is what I get:

and here's ONE of the things I've tried, but of course, it doesn't work:

So basically, I'm taking the value of theVar1, divide by 3600 (seconds in an hour), then truncate the answer to 2 decimal places, and then put it back into a Indigo Variable. Do I need to create a new variable to be the x,2 number, and then put that back into the Indigo Variable ?

Here is my original code:

- Code: Select all
`theDifa =str(float(theVar1.value) /3600) #seconds into hours`

indigo.variable.updateValue(1924530586, ((theDifa)))

and this is what I get:

7.53694444444

and here's ONE of the things I've tried, but of course, it doesn't work:

- Code: Select all
`theDifa =str(float(theVar1.value) /3600) #seconds into hours`

answer = str(round(theDifa, 2))

indigo.variable.updateValue(1924530586, ((theDifaR1)))

So basically, I'm taking the value of theVar1, divide by 3600 (seconds in an hour), then truncate the answer to 2 decimal places, and then put it back into a Indigo Variable. Do I need to create a new variable to be the x,2 number, and then put that back into the Indigo Variable ?