Jul-28-2019, 12:06 AM
Lists are mutable, and are therefore copied and passed by reference. 'a' is not a list, it is a pointer to a list.
word = a
copies the pointer not the list. So everything you do to word you do to a, and vice versa. You need to copy the list pointed to by a, with something like word = a[:]
. Or just make a new list, word = [''] * len(a)
, since you are overwriting everything in word anyway.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures