[Tutor] Calculate hours

Dave Angel d at davea.name
Wed Jan 23 11:12:42 CET 2013


On 01/22/2013 11:18 PM, anthonym wrote:
> Thanks Dave
>
> I think I would like to keep it simple.  How would I get it to repeat and
> print before deleting?
>

To repeat something, write a loop.  So you have a while loop *outside* 
the one you've written (you'll have to indent your present loop another 
level).  The condition for the while loop is simply a test to see if 
matrix has any elements in it.

So your outer loop loops till the matrix is empty.  Inside the loop, 
determine the minimum element, print it out, then delete it.

If you're familiar with functions yet, then move the inner loop into its 
own function, and it'll read more clearly.


-- 
DaveA


More information about the Tutor mailing list