Personally for me, this code gives strange output, I don't understand why.
Input:
matrix = [[0] * 5] * 5
for i in range(5):
matrix[i][0] = i
matrix
Output:
[[4, 0, 0, 0, 0],
[4, 0, 0, 0, 0],
[4, 0, 0, 0, 0],
[4, 0, 0, 0, 0],
[4, 0, 0, 0, 0]]
Expected output:
[[0, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[2, 0, 0, 0, 0],
[3, 0, 0, 0, 0],
[4, 0, 0, 0, 0]]