David Craig wrote:

> distance = [[]]*len(stations)

That doesn't do what you think it does:
 
>>> a = [[]] * 3
>>> a
[[], [], []]
>>> a[0].append(42)
>>> a
[[42], [42], [42]]

See? You get a list that contains the same list len(stations) times. Use

[[] for _ in stations]

instead.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to