Sorry, I should have been more clear in what I was trying to accomplish. I
am trying to build the latin square as follows:
1234567
2345671
3456712
4567123
5671234
6712345
7123456
So, the "scaleorder" is the n*n scale of the square - in this case, a 7x7.
The key is that there should be no duplicate number for each row and for
each column. And the "topleft" variable is the number in the topleft that
sets how the rest of the square will look - in the example I gave above, it
is 1.
The link below is the original exercise - I am not in school, purely for my
own education as I am really trying hard to become a passable Python
programmer. I've been working at it for 6 month now, and I don't know any
other languages:
http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/02_Control/LatinSquares/Project03.pdf
Thank you,
Brandon
On Mon, Dec 31, 2012 at 3:00 AM, wrote:
> Send Tutor mailing list submissions to
> tutor@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
> tutor-requ...@python.org
>
> You can reach the person managing the list at
> tutor-ow...@python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
>
> Today's Topics:
>
>1. Re: help (Mike G)
>2. another for loop question - latin square (Brandon Merritt)
>3. Re: another for loop question - latin square (Steven D'Aprano)
>4. Re: another for loop question - latin square (Dave Angel)
>5. Re: another for loop question - latin square (Mitya Sirenef)
>6. Re: another for loop question - latin square (Alan Gauld)
>
>
> --
>
> Message: 1
> Date: Sun, 30 Dec 2012 04:30:21 -0800
> From: Mike G
> To: tutor@python.org
> Subject: Re: [Tutor] help
> Message-ID:
> pqyxqp14vg608u5ry-6nr2fy-x6m1-...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Randy
>
> > I am an older newbie teaching myself Python programming.
> >
>
> Me too :)
>
> > My problem is I hear no system bell; the enter doesn't respond by
> quitting the program;
> > The problem with the program code the enter key hasn't worked in earlier
> programs.
> >
> > I appreciate any advice I may recieve with this coding glitch.
> >
>
> I copied the code into a blank .py file and ran it from cmd in Windows
> XP x86 using Python 273, it worked fine - including the beep. As well,
> hitting "Enter" exited the program.
>
> It sounds like (no pun intended) it may be how you're running the
> program. I would use a py file and run it using cmd - holler if you
> need help, you may if the path to Python isn't good to go.
>
> Mike
>
>
> --
>
> Message: 2
> Date: Sun, 30 Dec 2012 15:59:14 -0800
> From: Brandon Merritt
> To: tutor@python.org
> Subject: [Tutor] another for loop question - latin square
> Message-ID:
> <
> caehlphwnwwz82bv52m3bpbbyoqjtpfvxn2wulbsio_t3cmn...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I am having trouble figuring out a solution after a couple hours now of
> playing with the code. I'm trying to make a latin square using the code
> below:
>
> scaleorder = int(raw_input('Please enter a number for an n*n square: '))
>
>
> topleft = int(raw_input('Please enter the top left number for the square:
> '))
>
> firstrow = range((topleft),scaleorder+1)
>
> count = 0
>
> while count < 8:
> for i in firstrow:
> print i
> count += 1
> firstrow[i+1]
>
>
> ---
>
> It seemed like I could make the for loop work by doing something like this:
>
> for i in firstrow:
> print i, i+2
>
>
> but that obviously is not a solution either. Any ideas?
>
> Thanks,
> Brandon
> -- next part ------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/tutor/attachments/20121230/0d206b45/attachment-0001.html
> >
>
> --
>
> Message: 3
> Date: Mon, 31 Dec 2012 11:27:22 +1100
> From: Steven D'Aprano
> To: tutor@python.org
> Subject: Re: [Tutor] another for loop question - latin square
> Message-ID: <50e0dbea.5060...@pearwood.info>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> On 31