Re: [Python-ideas] Python list of list matrixes without NumPy

April 6, 2019
7:49 p.m.
On Sat, Apr 6, 2019 at 4:11 AM Steve Barnes <gadgetsteve@live.co.uk> wrote:
ipython
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: [[False]*2]*5
Out[1]:
[[False, False],
[False, False],
[False, False],
[False, False],
[False, False]]
# Looks like exactly what was wanted
[ins] In [1]: x = [[False]*2]*5 [ins] In [2]: x Out[2]: [[False, False], [False, False], [False, False], [False, False], [False, False]] [ins] In [3]: x[1][1] = True [ins] In [4]: x Out[4]: [[False, True], [False, True], [False, True], [False, True], [False, True]] -- Juancarlo *Añez*
2182
Age (days ago)
2182
Last active (days ago)
0 comments
1 participants
participants (1)
-
Juancarlo Añez