0

Here is my sample code:

#!/usr/bin/python

import sys

m=1
n=1

f = [[0]*(m+1)]*(n+1)

for i in range (1, n+1):
    for j in range (0, m+1):

        f[i][j] = 101

        print "check 1: " + str(f[i][j])

        f[i-1][j] = 102

        print "check 2: " + str(f[i][j])
        print"\n"

The output I get:

check 1: 101
check 2: 102

check 1: 101
check 2: 102

While I'm changing the f[i-1][j], why the value for f[i][j] would change ?

Chen Li
  • 63
  • 5

0 Answers0