[Tutor] Table or Matrix Whatever

alan.gauld@bt.com alan.gauld@bt.com
Thu, 6 Apr 2000 17:42:35 +0100


> I would like to know how can i creat a table or matrix. I 
> need to store datas like:
> 
>         1         2        3
> q1      a         b       a,b
> q2      b         a        a
> 
> And how can i acess the datas from table like:
> test[2][2]=a

A two dimensional list?

>>> table = [ ['a','b',('a','b')],['b','a','a']]
>>> table[1][1]
'a'
>>> table[0][2]
('a','b')


Note: it has to be a zero based index.

Alan g.