[Tutor] Fwd: Python bingo game.

zhijun long longelp at gmail.com
Thu Apr 3 06:21:03 CEST 2014


>>> matrix = [
...         [1, 2, 5, 7, 9],
...         [25, 67, 78, 23, 34],
...         [33, 22, 66, 88, 98],
...         [32, 31, 41, 56, 78],
...         [21, 34, 58, 99, 76],
...         ]
>>> for item in [[row[i] for row in matrix] for i in range(5)]:
...     print item
...
[1, 25, 33, 32, 21]
[2, 67, 22, 31, 34]
[5, 78, 66, 41, 58]
[7, 23, 88, 56, 99]
[9, 34, 98, 78, 76]
>>>


2014-03-31 22:36 GMT+08:00 Hardik Gandhi <hgandhi7760 at yahoo.com>:

>
> > Hello,
> >
> > Can some one help me with displaying a matrix vertically.
> >
> > For example my output matrix is:-
> >
> > [1 2 5 7 9]
> > [25 67 78 23 34]
> > [33 22 66 88 98]
> > [32 31 41 56 78]
> > [21 34 58 99 76]
> >
> > And i want my matrix to look like this:-
> > [1 25 33 32 21]
> > [2 67 22 31 34]
> > [5 78 66 41 58]
> > [7 23 88 56 99]
> > [9 34 98 78 76]
> >
> > Please, help me with the code in eclipse using py-dev as preference.
> >
> > Thank you
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140403/2e500d6d/attachment.html>


More information about the Tutor mailing list