I declared an array of array by two methods:
Method 1:
bucket = [[]] * 6)
Method 2:
bucket = [[] for i in range(6)]
but while appending elements to the inner array it works diferrently.
bucket[0].append(1)
print(bucket)
the results come out to be this:
When using Method 1:
Output:
[[1], [1], [1], [1], [1], [1], [1]]
When using Method 2:
Output:
[[1], [], [], [], [], [], []]
I want to understand why this is giving me two different type of results.