Re: [Tutor] class function problem

2010-09-22 Thread Steven D'Aprano
On Thu, 23 Sep 2010 05:55:36 am Steven D'Aprano wrote: > You will find the divmod() function useful. divmod(a, b) returns > two numbers: > > a/b as a whole number, any remainder left only Arggh! Of course I meant any reminder left OVER. -- Steven D'Aprano _

Re: [Tutor] class function problem

2010-09-22 Thread Steven D'Aprano
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

Re: [Tutor] class function problem

2010-09-22 Thread Hugo Arts
On Wed, Sep 22, 2010 at 5:17 PM, Roelof Wobben wrote: >> >> That's very clever. But you might argue that recursion is technically >> still a loop, albeit an implicit one. There is a simpler way to do >> this, without loops entirely. >> >> Hint: repeated subtraction while your number is greater tha

Re: [Tutor] class function problem

2010-09-22 Thread Roelof Wobben
> From: hugo.yo...@gmail.com > Date: Wed, 22 Sep 2010 16:16:45 +0200 > Subject: Re: [Tutor] class function problem > To: rwob...@hotmail.com > CC: tutor@python.org > > On Wed, Sep 22, 2010 at 9:10 AM, Roelof Wobben wrote: >>

Re: [Tutor] class function problem

2010-09-22 Thread Hugo Arts
On Wed, Sep 22, 2010 at 9:10 AM, Roelof Wobben wrote: > > > HEllo, > > I have this exercise : > > 3.Rewrite the increment function so that it doesn’t contain any loops. > > The increment function looks like this : > > def increment(time, seconds): >    time.seconds = time.seconds + seconds >    wh

[Tutor] class function problem

2010-09-22 Thread Roelof Wobben
HEllo, I have this exercise : 3.Rewrite the increment function so that it doesn’t contain any loops. The increment function looks like this : def increment(time, seconds): time.seconds = time.seconds + seconds while time.seconds>= 60: time.seconds = time.seconds - 60