Re: Multidimensional arrays/lists

2009-09-28 Thread Simon Forman
On Mon, Sep 28, 2009 at 3:27 PM, Ethan Furman wrote: > Simon Forman wrote: >> >> On Sun, Sep 27, 2009 at 12:40 PM, Someone Something >> wrote: >> >>> I'm trying to write a little tic-tac-toe program I need a array/list such >>> that I can represent the tic tac toe board with an x axis and y axis

Re: Multidimensional arrays/lists

2009-09-28 Thread Ethan Furman
Simon Forman wrote: On Sun, Sep 27, 2009 at 12:40 PM, Someone Something wrote: I'm trying to write a little tic-tac-toe program I need a array/list such that I can represent the tic tac toe board with an x axis and y axis and i can access each square to find out whether there is an X or an O.

Re: Multidimensional arrays/lists

2009-09-27 Thread Simon Forman
On Sun, Sep 27, 2009 at 12:40 PM, Someone Something wrote: > I'm trying to write a little tic-tac-toe program I need a array/list such > that I can represent the tic tac toe board with an x axis and y axis and i > can access each square to find out whether there is an X or an O. I have > absolutel

Re: Multidimensional arrays/lists

2009-09-27 Thread Rhodri James
On Sun, 27 Sep 2009 17:40:57 +0100, Someone Something wrote: I'm trying to write a little tic-tac-toe program I need a array/list such that I can represent the tic tac toe board with an x axis and y axis and i can access each square to find out whether there is an X or an O. I have absolut

Re: Multidimensional arrays/lists

2009-09-27 Thread Gary Herron
Someone Something wrote: I'm trying to write a little tic-tac-toe program I need a array/list such that I can represent the tic tac toe board with an x axis and y axis and i can access each square to find out whether there is an X or an O. I have absolutely no idea how to do this in python and

Re: multidimensional "arrays"

2007-12-06 Thread Jeremy Sanders
Horacius ReX wrote: > do you know how to do similar but in two dimensions ? Investigate the numpy module if you are dealing with numbers. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: multidimensional "arrays"

2007-12-06 Thread Remco Gerlich
Hi, DATA = [ [ 0 for i in range(ncolumns) ] for i in range(nrows) ] Is one way. DON'T do it like this: row = [0] * ncolumns data = [ row ] * nrows # WRONG! Since after that, every row is the exact same object; if you set data[0][0] = 1, the first element of _every_ row is 1. But I guess you a

Re: multidimensional "arrays"

2007-12-06 Thread bearophileHUGS
Horacius ReX: > do you know how to do similar but in two dimensions ? >>> nr = 3 >>> nc = 4 >>> [[None] * nc for _ in xrange(nr)] [[None, None, None, None], [None, None, None, None], [None, None, None, None]] Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Multidimensional arrays - howto?

2005-02-16 Thread Colin J. Williams
[EMAIL PROTECTED] wrote: Hello all, I am trying to convert some C code into python. Since i am new to python, i would like to know how to deal with multidimensional arrays? Thanks, -Joe Here's a snippet of what i am trying to convert: # define table0 15 # define table1 20 unsigned int Table[table0]

Re: Multidimensional arrays - howto?

2005-02-14 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > I am trying to convert some C code into python. Since i am new to > python, i would like to know how to deal with multidimensional arrays? http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list might be helpful. -- http://mail.p

Re: Multidimensional arrays - howto?

2005-02-14 Thread Daniel Yoo
[EMAIL PROTECTED] wrote: : Hello all, : I am trying to convert some C code into python. Since i am new to : python, i would like to know how to deal with multidimensional arrays? Here you go: http://python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list Also, if your tab