How do 2 dimentional lists work in Python
<p>I am doing <a href="http://projecteuler.net/problem=15" rel="nofollow">Project Euler Problem 15</a>. I used the right algorithm, but it didn't seem to work. Here's my code:</p>

<pre><code>f = [[0] * 21] * 21

# init the list
for i in range(21):
    f[0][i] = 1
    f[i][0] = 1

for i in range(21):
    for j in range(21):
        f[i][j] = f[i-1][j] + f[i][j-1]

print f[20][20]
</code></pre>

<p>when I finished initializing the list, I printed it. I expected it like <code>[[1, 1, 1...], [1, 0, 0...]...]</code>, but it turned <code>[[1, 1, 1...], [1, 1, 1...]...]</code> and I can't figure why.</p>

<p>I used to use C-like language and I thought the list in Python is kind of like the array in C, so I used them in the same way.</p>
