[Tutor] Exercise in writing a python function
Kermit Rose
kermit at polaris.net
Wed Aug 9 16:13:20 CEST 2006
Message: 2
Date: Wed, 9 Aug 2006 16:04:27 +1200
From: "John Fouhy" <john at fouhy.net>
Subject: Re: [Tutor] Exercise in writing a python function.
To: "Tutor mailing list" <tutor at python.org>
Hi Kermit,
Your basic data structure is a list (actually, several related lists),
which you work your way through. So I would start off with a for
loop:
for k in range(len(mult)):
Then, in the body of the loop, your basic logic is:
Add 1 to mult[k].
If mult[k] is not too big, exit.
Otherwise, ...
Hmm, actually, I'm not sure I do understand. Does mpylist ever
change? How is mult related to zlim?
--
John.
*****
Thank you.
I confused things by my mistake in the specifications.
The criterion for exiting the outer loop is that
mpylist[0][1] * mult[0] + mpylist[1][1] * mult[1] + mpylist[2][1] * mult[2]
+ . . .
be > zlim.
More information about the Tutor
mailing list