[Tutor] class function problem

Steven D'Aprano steve at pearwood.info
Wed Sep 22 21:55:36 CEST 2010


On Thu, 23 Sep 2010 01:17:59 am Roelof Wobben wrote:

> Sorry. I don't get it.
> When I have 62 seconds that's 1 minutes and 2 seconds.
> I have no clue how I can this with a division.

If you have 60 seconds, you have one minute.

If you have 120 minutes, you have two minutes. Can you get from 120 to 2 
using a division?

You will find the divmod() function useful. divmod(a, b) returns two 
numbers:

a/b as a whole number, any remainder left only



-- 
Steven D'Aprano


More information about the Tutor mailing list