Hello
I'm a beginner to python. I ran following code and expected [[1, 0], [0, 0], [0, 0]] However unexpected result came up. Anybody who can teach me why and how to solve? Python 3.2.3 (default, May 19 2012, 23:34:41) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> [1] *3 [1, 1, 1] >>> [[0,0]]*3 [[0, 0], [0, 0], [0, 0]] >>> a = [[0,0]]*3 >>> a [[0, 0], [0, 0], [0, 0]] >>> a[0][0] += 1 >>> a [[1, 0], [1, 0], [1, 0]] Kang, Yang Jae Ph.D. Cropgenomics Lab. College of Agriculture and Life Science Seoul National University Korea
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor