Dear Python group, I had written following code. super = [] sub = [""]*3 other = ["a","b","c","d"] sub[0] = "hi" sub[1] = "hello" for item in other: sub[2] = item super.append(sub) for item in super: print item
Output : ['hi', 'hello', 'd'] ['hi', 'hello', 'd'] ['hi', 'hello', 'd'] ['hi', 'hello', 'd'] Expected output: ['hi', 'hello', 'a] ['hi', 'hello', 'b'] ['hi', 'hello', 'c'] ['hi', 'hello', 'd'] Is there anything wrong in this code or any feature of python? Thanks and regards, Rasika Sapate. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor