thanks for the reply, btw. On Sun, Mar 23, 2008 at 4:22 PM, Marc Tompkins <[EMAIL PROTECTED]> wrote:
> On Sun, Mar 23, 2008 at 4:16 PM, elis aeris <[EMAIL PROTECTED]> wrote: > > > in c++ i use array[n][n] to store things. > > > > how do i create an array like that? > > > > Python doesn't have "arrays". It has tuples, lists, and dictionaries. A > quick Google will tell you the distinctions between them. > > It looks to me like you want to create a list of lists.... > > > t =[ ["item1", "item2", "item3"], ["itemA", "itemB", "itemC"], ["itemI", > "itemII", "itemIII"] ] > > t[0][0] == "item1" > t[1][1] == "itemB" > t[2][2] == "itemIII" > > > > > > > > > > > > > > > > > On Sun, Mar 23, 2008 at 4:13 PM, bob gailer <[EMAIL PROTECTED]> > > wrote: > > > > > elis aeris wrote: > > > > t = 12345, 54321, "hello!" > > > > print t[0] > > > > > > > > the way the 3 items are saved and access fits my need, now how do I > > > > make t have more than one entry so effectively I get this? > > > > > > > > t[n][n] > > > > > > > (1) are you going through the tutorials as requested? > > > (2) please learn how to ask meaningful questions > > > For example t[n][n] does not communicate the outcome you desire. > > > In Python t[n][n] would get you the nth element of the nth element of > > > t. > > > For example if n were 2 you'd get 3. If that is what you want you just > > > answered your own question, as a simple test in the Python interactive > > > window would reveal. > > > > > > Otherwise we can only guess as to what you want and that wastes all of > > > our time! > > > > > > It would be far more effective to show us what the result would look > > > like based on the data you entered into t. > > > > > > PLEASE do as much as you can to solve problems yourself and express > > > questions CLEARLY! > > > > > > -- > > > Bob Gailer > > > 919-636-4239 Chapel Hill, NC > > > > > > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > > > > > -- > www.fsrtechnologies.com
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor