Hello, I’m having trouble understanding the following behavior and would greatly appreciate any insight.
l = [1,2,3,4] b=[] for i in range(l): print l b.append(l) l.pop(0) print b OUTPUT [1,2,3,4] [2,3,4] [3,4] [4] [[],[],[],[]] My confusions is the output for b. I don’t understand why it’s empty. I’m expecting for b to equal [[1,2,3,4], [2,3,4], [3,4], [4]]. Best Regards, Rick _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor