Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread phamtony33
Can anyone direct me in the direction where to start the code for the randomized of the ball to start. from Tkinter import * window = Tk() canvas = Canvas(window, width=500, height=500, background="green") canvas.pack() def mouse_paddle_move(event): mouseY = event.y

Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread phamtony33
On Friday, December 11, 2015 at 7:55:59 PM UTC-5, Steven D'Aprano wrote: > On Sat, 12 Dec 2015 10:19 am, phamton...@gmail.com wrote: > > > Can anyone direct me in the direction where to start the code for the > > randomized of the ball to start. > > [...] > > move_ball(-10, 7, 0) > > > That

Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread Erik
Hi, On 11/12/15 23:19, phamton...@gmail.com wrote: Can anyone direct me in the direction where to start the code for the randomized of the ball to start. Your questions over the last week or so appear to be homework assignments. However, I'll give you a hint: in the interactive

Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread Erik
Hi, On 11/12/15 23:19, phamton...@gmail.com wrote: Can anyone direct me in the direction where to start the code for the randomized of the ball to start. Your questions over the last week or so appear to be homework assignments. However, I'll give you a hint: in the interactive

Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread Steven D'Aprano
On Sat, 12 Dec 2015 10:19 am, phamton...@gmail.com wrote: > Can anyone direct me in the direction where to start the code for the > randomized of the ball to start. [...] > move_ball(-10, 7, 0) That starts the ball moving, with x-speed of -10 and y-speed of 7. Instead use something similar

Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread Rick Johnson
On Friday, December 11, 2015 at 5:20:13 PM UTC-6, phamt...@gmail.com wrote: > Can anyone direct me in the direction where to start the code for the > randomized of the ball to start. No, because your problem needs to be simplified first. A good first step would be to create a new script that

Re: Can anyone help me modify the code so the ball starts in random directions

2015-12-11 Thread phamtony33
from Tkinter import * window = Tk() canvas = Canvas(window, width=500, height=500, background="green") canvas.pack() def mouse_paddle_move(event): mouseY = event.y current_coords = canvas.coords("paddle") x1 = current_coords[0] y1 = current_coords[1] x2 =

Re: Help me write better Code

2014-07-10 Thread sssdevelop
Thank you so much Terry Jan Reedy. You have given best advice - yup, i am beginner in Python. Your reply has done grooming :) thx, On Thursday, July 10, 2014 12:16:48 AM UTC+5:30, Terry Reedy wrote: On 7/9/2014 10:27 AM, sssdevelop wrote: Hello, I have working code - but

Re: Help me write better Code

2014-07-10 Thread sssdevelop
thank you so much! On Wednesday, July 9, 2014 11:46:41 PM UTC+5:30, Ian wrote: On Wed, Jul 9, 2014 at 8:27 AM, sssdevelop sssdeve...@gmail.com wrote: prev = 0 blocks = [] tmp = [] last = 0 for element in a: if prev == 0: Is 0 allowed to be in the input list?

Re: Help me write better Code

2014-07-10 Thread sssdevelop
Mark - thank you so much. You have suggested be new best tool/module. It's going to help me many places. Was not aware of such powerful tool. thank you, On Wednesday, July 9, 2014 9:14:01 PM UTC+5:30, Mark Lawrence wrote: On 09/07/2014 15:27, sssdevelop wrote: Hello, I have

Re: Help me write better Code

2014-07-10 Thread Mark Lawrence
On 10/07/2014 15:39, sssdevelop wrote: Mark - thank you so much. You have suggested be new best tool/module. It's going to help me many places. Was not aware of such powerful tool. thank you, I'm pleased to see that you have several answers. In return would you please use the mailing list

Re: Help me write better Code

2014-07-10 Thread Rustom Mody
On Wednesday, July 9, 2014 9:14:01 PM UTC+5:30, Mark Lawrence wrote: On 09/07/2014 15:27, sssdevelop wrote: Hello, I have working code - but looking for better/improved code. Better coding practices, better algorithm :) Problem: Given sequence of increasing integers, print blocks of

Help me write better Code

2014-07-09 Thread sssdevelop
Hello, I have working code - but looking for better/improved code. Better coding practices, better algorithm :) Problem: Given sequence of increasing integers, print blocks of consecutive integers. Example: Input: [10, 11, 12, 15] Output: [10, 11, 12] Input: [51, 53, 55, 67, 68, 91, 92,

Re: Help me write better Code

2014-07-09 Thread Mark Lawrence
On 09/07/2014 15:27, sssdevelop wrote: Hello, I have working code - but looking for better/improved code. Better coding practices, better algorithm :) Problem: Given sequence of increasing integers, print blocks of consecutive integers. Example: Input: [10, 11, 12, 15] Output: [10, 11, 12]

Re: Help me write better Code

2014-07-09 Thread Ian Kelly
On Wed, Jul 9, 2014 at 8:27 AM, sssdevelop sssdeve...@gmail.com wrote: prev = 0 blocks = [] tmp = [] last = 0 for element in a: if prev == 0: Is 0 allowed to be in the input list? What would happen if it were? next This line doesn't do anything. It looks up the builtin function

Re: Help me write better Code

2014-07-09 Thread Terry Reedy
On 7/9/2014 10:27 AM, sssdevelop wrote: Hello, I have working code - but looking for better/improved code. Better coding practices, better algorithm :) Problem: Given sequence of increasing integers, print blocks of consecutive integers. Input: [51, 53, 55, 67, 68, 91, 92, 93, 94, 99]

Re: Help me with this code

2013-11-07 Thread Piet van Oostrum
chovd...@gmail.com writes: Hi friends help me with the following code. Im able to execute the code but getting wrong output def sequence_b(N): N = 10 result = 0 for k in xrange (1,N): result += ((-1) ** (k+1))/2*k-1 print result print sequence_b(10

Re: Help me with this code PLEASE

2013-11-06 Thread Antoon Pardon
Op 05-11-13 22:26, Nick the Gr33k schreef: I know i'm close to solution, i can feel it but i have some issues. The code we arr discussing is the following: No you are not. You are just doing random changes, without any understanding. If you had followed my suggestion and actually read the

Re: Help me with this code PLEASE

2013-11-06 Thread Mark Lawrence
On 06/11/2013 01:14, Nick the Gr33k wrote: How, do i i proceed? If at first you don't succeed, keep asking on comp.lang.python until someone gives me the completely bodged solution that I keep asking for even if it's complete nonsense. -- Python is the second best programming language in

Re: Help me with this code PLEASE

2013-11-06 Thread Joel Goldstick
On Wed, Nov 6, 2013 at 3:49 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 06/11/2013 01:14, Nick the Gr33k wrote: How, do i i proceed? If at first you don't succeed, keep asking on comp.lang.python until someone gives me the completely bodged solution that I keep asking for even if

Re: Help me with this code PLEASE

2013-11-06 Thread Grant Edwards
On 2013-11-06, Denis McMahon denismfmcma...@gmail.com wrote: On Wed, 06 Nov 2013 00:35:56 +0200, Nick the Gr33k wrote: Now i realizes i just cannot store lists into it's columns because it does not support a collection datatype. All databases support storing of collections, but *NOT THE WAY

Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
== # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE counterID = %s and host = %s''', (cID, host) ) data = cur.fetchone() ref

Re: Help me with this code PLEASE

2013-11-05 Thread Antoon Pardon
= IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM

Re: Help me with this code PLEASE

2013-11-05 Thread mm0fmf
EVERYHTIGN I TRIED FAILED. Maybe try some of the advice you have been given instead? -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with this code PLEASE

2013-11-05 Thread Steven D'Aprano
On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO LONG STRINGS SO I CAN STORE SUCCESSFULLY LIST

Re: Help me with this code PLEASE

2013-11-05 Thread Antoon Pardon
Op 05-11-13 18:41, Steven D'Aprano schreef: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO LONG

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 7:41 μμ, ο/η Steven D'Aprano έγραψε: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. Try starting with something simple. The following is a step by step guide to working out how you need to do this. Follow all the steps. Do not skip any steps. Each stage

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 8:02 μμ, ο/η Denis McMahon έγραψε: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. Try starting with something simple. The following is a step by step guide to working out how you need to do this. Follow

Re: Help me with this code PLEASE

2013-11-05 Thread Tobiah
All this problem arises because MySQL's hasn't got a datatype able to store an array of elements, a list. Um, yes it does. It's called a table. -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with this code PLEASE

2013-11-05 Thread Joel Goldstick
On Tue, Nov 5, 2013 at 1:11 PM, Tobiah t...@tobiah.org wrote: All this problem arises because MySQL's hasn't got a datatype able to store an array of elements, a list. Um, yes it does. It's called a table. -- https://mail.python.org/mailman/listinfo/python-list Perhaps we are splitting

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Tue, 05 Nov 2013 20:09:42 +0200, Nick the Gr33k wrote: Denis, i have already provided my code trying to do what i need and i need some commendation on how to make it work. Nick, you're obviously trying to code way above your abilities. If you want me to write your code, you will have to

Re: Help me with this code PLEASE

2013-11-05 Thread John Gordon
In l5b8if$4k1$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 20:19, John Gordon wrote: In l5b8if$4k1$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 10:19 μμ, ο/η John Gordon έγραψε: In l5b8if$4k1$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 21:17, Mark Lawrence wrote: On 05/11/2013 20:19, John Gordon wrote: In l5b8if$4k1$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST

Re: Help me with this code PLEASE

2013-11-05 Thread Chris Angelico
On Wed, Nov 6, 2013 at 8:17 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: I've taken a different approach. I've put the contract out to tender and hereby give you the winners http://www.mudefordwoodcommunitycentre.co.uk/playgroup-and-tiny-tots/ Sounds good! But I don't see a list of their

Re: Help me with this code PLEASE

2013-11-05 Thread John Gordon
In l5bnpc$71v$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE counterID = %s and host = %s''', (cID, host) )

Re: Help me with this code PLEASE

2013-11-05 Thread Piet van Oostrum
Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:06 πμ, ο/η John Gordon έγραψε: In l5bnpc$71v$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:15 πμ, ο/η Piet van Oostrum έγραψε: Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 22:28, Nick the Gr33k wrote: Στις 6/11/2013 12:06 πμ, ο/η John Gordon έγραψε: In l5bnpc$71v$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits,

Re: Help me with this code PLEASE

2013-11-05 Thread John Gordon
In l5brem$trk$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: The code i provided only worked once before it failed and managed to store this: counterID,host,refs,city,userOS,browser,visits,hits,download -

Re: Help me with this code PLEASE

2013-11-05 Thread Cameron Simpson
On 05Nov2013 20:09, Nikos nikos.gr...@gmail.com wrote: O even better an rdbms than allows complex data such as tuples, lists, dicts to be saved into the db as they are so i dont have to cobvet back and forth each time. If you're just using the db for storage or adhoc and arbitrary python

Re: Help me with this code PLEASE

2013-11-05 Thread bob gailer
There is also the shelve module. It uses pickle to marshal a Python object, then stores it in a file under a key. Sample code from the module documentation: import shelve d = shelve.open(filename) # open -- file may get suffix added by low-level library d[key] = data # store data at

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 22:31, Cameron Simpson wrote: On 05Nov2013 20:09, Nikos nikos.gr...@gmail.com wrote: O even better an rdbms than allows complex data such as tuples, lists, dicts to be saved into the db as they are so i dont have to cobvet back and forth each time. If you're just using the db

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Wed, 06 Nov 2013 00:35:56 +0200, Nick the Gr33k wrote: Now i realizes i just cannot store lists into it's columns because it does not support a collection datatype. All databases support storing of collections, but *NOT THE WAY YOU WANT TO DO IT* You refuse to do it the proper way, so you

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:54 πμ, ο/η John Gordon έγραψε: The code i provided only worked once before it failed and managed to store this: counterID,host,refs,city,userOS,browser,visits,hits,download - 1, 176-92-96-218.adsl.cyta.gr,

Re: Help me with this code PLEASE

2013-11-05 Thread Ben Finney
Denis McMahon denismfmcma...@gmail.com writes: You have been told several times by several people how to do this properly. You insist on using your bodged up solution instead. OK, we'll all try and help you bodge up a solution[…] Why? No-one here is obligated to help with implementing a

Help me with this code

2013-11-05 Thread chovdary
Hi friends help me with the following code. Im able to execute the code but getting wrong output def sequence_b(N): N = 10 result = 0 for k in xrange (1,N): result += ((-1) ** (k+1))/2*k-1 print result print sequence_b(10) This is the output which im getting -1 -4

Representing fractions (was: Help me with this code)

2013-11-05 Thread Ben Finney
chovd...@gmail.com writes: def sequence_b(N): N = 10 result = 0 for k in xrange (1,N): result += ((-1) ** (k+1))/2*k-1 Every number here is an integer. Python 2 will keep all the computations integers by default:: $ python2 1 / 2 0 You want to use Python

Re: Help me with this code

2013-11-05 Thread MRAB
On 06/11/2013 01:51, chovd...@gmail.com wrote: Hi friends help me with the following code. Im able to execute the code but getting wrong output def sequence_b(N): N = 10 result = 0 for k in xrange (1,N): result += ((-1) ** (k+1))/2*k-1 print result print

Re: Help me with this code

2013-11-05 Thread Steven D'Aprano
On Tue, 05 Nov 2013 17:51:00 -0800, chovdary wrote: Hi friends help me with the following code. Im able to execute the code but getting wrong output [snip code] You have this critical expression in your code: result += ((-1) ** (k+1))/2*k-1 It looks to me like you are using Python 2

Re: Help me with this code

2013-11-05 Thread Dave Angel
On Tue, 5 Nov 2013 17:51:00 -0800 (PST), chovd...@gmail.com wrote: result += ((-1) ** (k+1))/2*k-1 One of two things are happening here. Maybe both. You're using Python 2.x (and should havesaid so) where integer division is truncated. You're missing around some part of the

Re: can some one help me with my code. thanks

2012-01-23 Thread Tamanna Sultana
On Jan 20, 11:03 pm, Chris Angelico ros...@gmail.com wrote: On Sat, Jan 21, 2012 at 1:23 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: Your variable names need a bit more thought def average(bin): What is a bin?

Re: can some one help me with my code. thanks

2012-01-23 Thread Tamanna Sultana
On Jan 20, 9:23 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: On Jan 20, 12:49 pm, Tamanna Sultana tamannas.rah...@gmail.com wrote: If you can give me some lead to fix the code I wrote below that will be great:

Re: can some one help me with my code. thanks

2012-01-22 Thread Vincent Vande Vyvre
Le 20/01/12 20:30, Vincent Vande Vyvre a crit: Le 20/01/12 19:49, Tamanna Sultana a crit: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the

can some one help me with my code. thanks

2012-01-20 Thread Tamanna Sultana
can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the numbers separated by a string 'end'. I am expecting to have 4 averages from the above bin, since there are 4 sets of numbers separated by 4 'end' strings

Re: can some one help me with my code. thanks

2012-01-20 Thread Vincent Vande Vyvre
Le 20/01/12 19:49, Tamanna Sultana a crit: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the numbers separated by a string 'end'. I am expecting to have 4 averages from the

Re: can some one help me with my code. thanks

2012-01-20 Thread Terry Reedy
On 1/20/2012 1:49 PM, Tamanna Sultana wrote: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the numbers separated by a string 'end'. I am expecting to have 4 averages from the above bin, since there are 4 sets

Re: can some one help me with my code. thanks

2012-01-20 Thread Tim Chase
On 01/20/12 13:46, Terry Reedy wrote: def average(bin): num=[] total = 0.0 count=0 for number in bin: if number!='end': total += float(number) count+=1 else: num.append(total/count) total = 0.0

Re: can some one help me with my code. thanks

2012-01-20 Thread Terry Reedy
On 1/20/2012 2:46 PM, Terry Reedy wrote: On 1/20/2012 1:49 PM, Tamanna Sultana wrote: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the numbers separated by a string 'end'. I am expecting to have 4 averages

Re: can some one help me with my code. thanks

2012-01-20 Thread Rick Johnson
On Jan 20, 12:49 pm, Tamanna Sultana tamannas.rah...@gmail.com wrote: If you can give me some lead to fix the code I wrote below that will be great: Your variable names need a bit more thought def average(bin): What is a bin? Maybe you shoulc have called this a lst eh?     num=[] Why

Re: can some one help me with my code. thanks

2012-01-20 Thread Jon Clements
On Jan 20, 9:26 pm, Terry Reedy tjre...@udel.edu wrote: On 1/20/2012 2:46 PM, Terry Reedy wrote: On 1/20/2012 1:49 PM, Tamanna Sultana wrote: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the

Re: can some one help me with my code. thanks

2012-01-20 Thread Steven D'Aprano
On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: On Jan 20, 12:49 pm, Tamanna Sultana tamannas.rah...@gmail.com wrote: If you can give me some lead to fix the code I wrote below that will be great: Your variable names need a bit more thought def average(bin): What is a bin?

Re: can some one help me with my code. thanks

2012-01-20 Thread Chris Angelico
On Sat, Jan 21, 2012 at 1:23 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: Your variable names need a bit more thought def average(bin): What is a bin? Maybe you shoulc have called this a lst eh? Bin is a standard

Please help me understand this code....

2005-06-17 Thread randy
Hello, I am a programmer, but not a python guy. So I am a little confused with the following python code. Specifically what does the : do in the array arithmetic? new_page = map[opage] old_page = map[opage^1] center = new_page[1:-1,1:-1] origcenter = array(center) center[:]

Re: Please help me understand this code....

2005-06-17 Thread Jordan Rastrick
The : is used in Python for slice notation, which is explained pretty thoroughly in the Python tutorial, specifically at: http://www.python.org/doc/2.4/tut/node5.html -- http://mail.python.org/mailman/listinfo/python-list