Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdfMax filesize is 16 MB.Max image dimensions are 15000 x 15000. You may upload 3 per post.
File (hide): 167f6592f409207⋯.png (739 B, 275x114, 275:114, out.png) (h) (u)
▶Python test Anonymous 06/24/19 (Mon) 16:32:47 No.1072727>>1072738 >>1072811 [Watch Thread][Show All Posts]
Hello /tech/, do you know your Python?
If so, then why does the following code:
arr = [[0] * 2] * 3[print (arr [x][0]) for x in range (3)]arr [0][0] = 1print ("New:")[print (arr [x][0]) for x in range (3)]
print:
000New:111
?
▶Anonymous 06/24/19 (Mon) 17:44:44 No.1072738>>1072832 >>1072840
>>1072727 (OP)
>>733048
(0*2)*3=0
But I have neverever coded so my answer could be wrong.
▶Anonymous 06/24/19 (Mon) 17:50:13 No.1072740
Because when you multiply an array it copies by reference.
▶Anonymous 06/25/19 (Tue) 00:48:27 No.1072811
Because nested arrays are painful in Python.
t.faggot who had to use deepcopy more than once
▶Anonymous 06/25/19 (Tue) 02:17:10 No.1072832
>>1072738
>But I have neverever coded so my answer could be wrong.
Why did you post that then you fucking retarded nigger
▶Anonymous 06/25/19 (Tue) 02:40:53 No.1072840
That's an array you dumbfuck
▶Anonymous 06/25/19 (Tue) 02:49:09 No.1072842
/tech/ is not here to do your homework you fucking faggot