+ 3
What is the difference between the following two operations in Python?
lst = [1, 2] lst = lst + [3] and lst = [1, 2] lst.append(3)
1 Odpowiedź
+ 5
You append an element but you add a list.
An element can be everything also another list,
But the operator + of a list is only defined for another list.
in your case the result is the same