creating a matrix in python?
Pierre Fortin
pfortin at pfortin.com
Mon Jun 25 14:38:08 EDT 2001
Adonis wrote:
>
> how do i go about this?
>
> i have looked into the tutorial 100+ times and cant get anything on
> matrices out of it?
> only thing i came up with was some thing like:
> blah = ['buh', 'blah', 'wassah']
> blah[1][0]
> 'buh'
>
> ???
^^^ Right... I get this:
>>> blah = ['buh', 'blah', 'wassah']
>>> blah[1][0]
'b'
^^^
Formatted for clarity:
>>> m = [[1,2,3],
[4,5,6],
[7,8,9]]
>>> m[1][1]
5
>>> m3 = [[[1,2,3], [4,5,6], [7,8,9] ],
[[11,12,13],[14,15,16],[17,18,19]],
[[21,22,23],[24,25,26],[27,28,29]]]
>>> m3[1][1][1]
15
Pierre
> any help would greatly be appreciated.
>
> Adonis
--
Support Linux development: http://www.linux-mandrake.com/donations/
Last reboot reason: 06/22/01: added 512M memory
More information about the Python-list
mailing list