[Tutor] geekdad-puzzle-of-the-week-extreme-products

2012-08-20 Thread R. Alan Monroe
People hunting for Python projects to work on might get a kick out of this puzzle: http://www.wired.com/geekdad/2012/08/geekdad-puzzle-of-the-week-extreme-products/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

[Tutor] Error in apparently correct code

2012-08-20 Thread Osemeka Osuagwu
Dear Pythonistas (I hope you don't mind that), I wrote the following code to find the four adjacent numbers (in any direction in the array) which, when multiplied together, would yield the highest product to be gotten. I finally stumbled on the answer while studying the data itself but I'm still

Re: [Tutor] Error in apparently correct code

2012-08-20 Thread Mark Lawrence
On 20/08/2012 21:24, Osemeka Osuagwu wrote: Dear Pythonistas (I hope you don't mind that), I wrote the following code to find the four adjacent numbers (in any direction in the array) which, when multiplied together, would yield the I can't see a Python array anywhere. Do you mean the list of

Re: [Tutor] Error in apparently correct code

2012-08-20 Thread Rob Day
Your problem is in this line, as the traceback shows: return reduce(lambda x,y:x*y, [data[row][i] for i in range(col, col+4)]) So the thing you have to think about is - what values can col be? The answer is then in this line: for col in range(len(data[row])) And since each row of your data

Re: [Tutor] Error in apparently correct code

2012-08-20 Thread Mark Lawrence
On 20/08/2012 22:06, Rob Day wrote: Your problem is in this line, as the traceback shows: return reduce(lambda x,y:x*y, [data[row][i] for i in range(col, col+4)]) So the thing you have to think about is - what values can col be? The answer is then in this line: for col in

Re: [Tutor] Error in apparently correct code

2012-08-20 Thread xDog Walker
On Monday 2012 August 20 14:27, Mark Lawrence wrote: Give a man a fish, and you feed him for a day; show him how to catch fish, and you feed him for a lifetime. -- Cheers. Mark Lawrence. Teach a man to steal fish and he will live until he dies. -- Yonder nor sorghum stenches shut ladle

Re: [Tutor] Error in apparently correct code

2012-08-20 Thread Steven D'Aprano
On 21/08/12 06:24, Osemeka Osuagwu wrote: [...] p.s I apologise for the lack of comments Don't apologise for lack of comments, apologise for posting in HTML which causes your code to be mangled, leading indentation stripped, and generally turned into an unreadable mess. Indentation has

Re: [Tutor] Tutor Digest, Vol 102, Issue 48

2012-08-20 Thread Osemeka Osuagwu
Dear Mark, I can't see a Python array anywhere. Do you mean the list of lists? :) THE CODE [snipped as it's been mangled, was it posted in html and not plain text or what? I'm too lazy to unmangle it, others might be kinder] Again, my bad. Here's the code in plain text:

[Tutor] Escaping globs for glob.iglob()

2012-08-20 Thread Ray Jones
The code: curDir = os.getcwd() znDir = shutil.abspath('../') baseDir = shutil.abspath('../../') Files = glob.iglob(os.path.join(znDir, '*')) print Files for moveFile in Files: print moveFile shutil.move(moveFile, curDir) Nothing happens. The 'print...moveFile' never