Hallo.
In Python schreibt `a = [-1]` `in einer Schleife von Listen nicht die ursprüngliche Liste neu, sondern`
a [0] = -1``` Umschreiben.
alist = [[0], [0], [0]]
for a in alist:
a = [-1]
print(alist) # ==> [[0], [0], [0]]
for a in alist:
a[0] = -1
print(alist) # ==> [[-1], [-1], [-1]]
$ python3 -V
Python 3.7.7
Recommended Posts