Can this be reduced to a single line (after assigning a)?
a
a = [1,2,3] b = a[:] b.append(4)
The following is probably the simplest:
b = a + [4]
Here, you don't need a[:] since we're no longer copying the reference (+ creates and returns a new list anyway).
a[:]
+
1.4m articles
1.4m replys
5 comments
57.0k users