I have the following code:
distances = [[100001] * 2] * 2
for edge in edges:
print(distances)
distances[edge[0]][edge[1]] = edge[2]
print(distances)
print("\n")
edges is the following list of tuples:
edges = [(0, 1, 10), (1, 0, -9)]
I'm expecting this output:
[[100001, 100001], [100001, 100001]]
[[100001, 10], [100001, 100001]]
[[100001, 10], [100001, 100001]]
[[100001, 10], [-9, 100001]]
but I'm getting this output:
[[100001, 100001], [100001, 100001]]
[[100001, 10], [100001, 10]]
[[100001, 10], [100001, 10]]
[[-9, 10], [-9, 10]]
Any ideas what's wrong?