<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Prvni odpoved ;)<br>
<a class="moz-txt-link-freetext" href="https://stackoverflow.com/questions/2397141/how-to-initialize-a-two-dimensional-array-in-python">https://stackoverflow.com/questions/2397141/how-to-initialize-a-two-dimensional-array-in-python</a></div>
<div class="moz-cite-prefix">Don't use <code>[[v]*n]*n</code>, it
is a trap!</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">J.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 14.09.2022 14:01, Pavel Hudeček
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:6d96f7b4-6018-e93f-da12-cc628aa50ee3@seznam.cz">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Dobrý den všem,<br>
Python 3.9,<br>
program:<br>
arr = [[0] * 10] * 2<br>
<br>
arr[0][5] = 50<br>
arr[1][6] = 60<br>
<br>
print(arr)<br>
<br>
výsledek:<br>
[[0, 0, 0, 0, 0, <b><font color="#ff0000">50, 60</font></b>, 0,
0, 0], [0, 0, 0, 0, 0, <b><font color="#ff0000">50, 60</font></b>,
0, 0, 0]]<br>
<br>
Proč je 50 a 60 v první i druhé půlce?<br>
Jak teda udělat zápis jen jednoho prvku?<br>
<br>
Díky,<br>
PH<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Jindroush <a class="moz-txt-link-rfc2396E" href="mailto:jindroush@seznam.cz"><jindroush@seznam.cz></a></pre>
</body>
</html>