On 03/28/2014 10:42 AM, Jose Amoreira wrote:
[...] If we want to access individual rows of this matrix like
object, the standard slice notation (on the second index) works as expected
also:
In [3]: l[0][:]
Out[3]: [11, 12, 13]
In [4]: l[1][:]
Out[4]: [21, 22, 23]
Again, fine!
No! You *made
On 03/28/2014 10:32 AM, Alan Gauld wrote:
No, standard slices on the first element will give you sublists of the
first row. Python doesn't have any concept of that second dimension, it
only sees a list of items. The fact those items are themselves lists is
purely incidental to the interpreter.
On 28/03/14 09:42, Jose Amoreira wrote:
Hello!
Here is something that surprised me and I still didn't get it.
If we want to store a matrix in pure python (no numpy), the first thing
that comes to (my) mind is to use a list of lists, like the list l below:
In [1]: l=[
...:[11,12,13],
Jose,
Just for clarity, are you trying to access a particular *column* in your
last example?
Bob
Yes, that's it! I wanted to say "column", not "row" in my last example.
Sorry about that! Thanks
Jose
___
Tutor maillist - Tutor@python.org
To unsu
On 28/03/14 09:42, Jose Amoreira wrote:
> Hello!
> Here is something that surprised me and I still didn't get it.
>
> If we want to store a matrix in pure python (no numpy), the first thing
> that comes to (my) mind is to use a list of lists, like the list l below:
> In [1]: l=[
>...:[11,1
Hello!
Here is something that surprised me and I still didn't get it.
If we want to store a matrix in pure python (no numpy), the first thing
that comes to (my) mind is to use a list of lists, like the list l below:
In [1]: l=[
...:[11,12,13],
...:[21,22,23]
...: ]
We can ac