On Mon, 24 Apr 2017 20:02:32 +0100 Alan Gauld via Tutor <tutor@python.org> wrote:
> On 24/04/17 01:50, Phil wrote: > > On Mon, 24 Apr 2017 09:24:55 +1000 > > Phil <phil_...@bigpond.com> wrote: > > > >> On Sun, 23 Apr 2017 09:39:54 +0200 > >> Sibylle Koczian <nulla.epist...@web.de> wrote: > >> > >>> Am 20.04.2017 um 14:43 schrieb Alan Gauld via Tutor: > >>>> Its not too bad you can map the large 9x9 table to the smaller > >>>> units using divmod() > >>>> > >>>> So the 7th element becomes > >>>> divmod(7) -> 2,1 > >>>> > >>> > >>> Should be divmod(7, 3), shouldn't it? > > Yes, of course, sorry about that! > The 3 of course is the number of items per cell (3x3) > > > Say I want the 7th cell in the first line of a 9 x 9 grid, > > that would be x = 7, y = 1. > > But you want it mapped to a cell/item pair... > > divmod(7,3) -> 2,1 > > > The 3rd cell, 2nd item which is wrong for the item part. > So you need to use: > > 2, 1-1 Thank you Alan, problem solved. All this horsing around with adding and subtracting 1 had initially led to a mass of confusing code hence the posting of my second message on this subject. Don't bother with that message, it's complete nonsense. By the way, I notice that my messages to this list, and not other's, can take up to four hours (sometimes longer) to appear, is that normal? I'm on a bounces list, is that the reason? Probably not since I'm on several bounces lists. Anyway, enjoy your holiday. -- Regards, Phil _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor