[Tutor] matrix q? print the first column of matrix

Bob Gailer bgailer@alum.rpi.edu
Sat Jun 7 13:13:01 2003


--=====================_7182838==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 12:09 PM 6/7/2003 -0500, evros loizides wrote:

>i am try to print the columns of a square matrix but i getting only the 
>first number
>for example  myMatrix = [[2,3,4],[4,5,6],[7,8,9]]
>i want to print the first column only .
>how can i do that?

print [row[0] for row in myMatrix]

Bob Gailer
bgailer@alum.rpi.edu
303 442 2625

--=====================_7182838==.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<body>
At 12:09 PM 6/7/2003 -0500, evros loizides wrote:<br><br>
<blockquote type=cite class=cite cite><font face="arial" size=2>i am try
to print the columns of a square matrix but i getting only the first
number</font><br>
<font face="arial" size=2>for example&nbsp; myMatrix =
[[2,3,4],[4,5,6],[7,8,9]]</font><br>
<font face="arial" size=2>i want to print the first column only
.</font><br>
<font face="arial" size=2>how can i do that?</font></blockquote><br>
print [row[0] for row in <font face="arial" size=2>myMatrix</font>]<br>
<x-sigsep><p></x-sigsep>
Bob Gailer<br>
bgailer@alum.rpi.edu<br>
303 442 2625<br>
</body>
</html>

--=====================_7182838==.ALT--