# [sf-lug] [PYCLASS] Still on exercise 2.1

jim jim at well.com
Fri Oct 3 23:07:43 PDT 2008

```# convert all data to a common format

6:52 is 6 + 52/60 hours is 6.867 hours

8 minutes 15 seconds is 8.25 minutes which
is 0.138 hours

7 minutes 12 seconds is 7.20 minutes, which
is 0.12 hours

# do whatever operations are required

0.138 hours * 2 is 0.276 hours

0.12 hours * 3 = 0.36 hours

6.867 hours + 0.276 hours + 0.36 hours = 7.503 hours

# reconvert the data to the reporting format

7.503 hours % 1 = 0.503 hours  # modula gets the remainder

0.503 hours * 60 minutes/hour = 30 minutes  # which is the minutes

7 hours + 30 minutes == 7:30

yes, i did the conversions for my homework.
i took it easy with rounding off. there wasn't
specified the tasks to do to get the result,
as you can see above. consider reviewing the
"algorithm" i sent previously with the
arithmetic in this email.

On Fri, 2008-10-03 at 22:30 -0700, Christian Einfeldt wrote:
> hi
>
> On Fri, Oct 3, 2008 at 10:10 PM, jim <jim at well.com> wrote:
>
>
>           re-express all time in decimal format.
>           15 minutes is 0.25 hours. 52 is how many
>         parts of 60? (what's the decimal representation
>         of 6 and 52/60s of an hour?)
>           then you have a start time expressed in
>         decimal format, you add to that the running
>         time in decimal format, then you re-express
>         the sum as hours and minutes.
>           the trick is to convert all data to the
>         same format, at least with respect to a set
>         of related operations, and when done,
>         re-convert the final data to the format you
>         want to report.
>
> Did you do all of that for your homework?  I understand the Socratic
> method of inducing people to learn by walking them down the path and
> making them figure it out for themselves, but I did already try to do
> those conversions, but it was messy.  I would love it if you would
> post your results for this exercise, since I am so very close.  Thx
> either way.
>
> >>> 60.0/52.0
> 1.1538461538461537
> >>> 52.0/4.0
> 13.0
> >>> 60.0/4.0
> 15.0
> >>> 13.0/15.0
> 0.8666666666666667
> >>> 15.0/13.0
> 1.1538461538461537
> >>> 6.52+.06
> 6.5799999999999992
> >>>
>
>
>

```