In Python, lists have two methods for adding elements to the end: “append” and “extend”. One of them adds a single element to the list, and the other adds every element from an iterable to the end of the list. Do you know which is which? Did you know without having to look it up? If so, could you please share your secret for remembering which is which?
Share
At least for me their literal meaning itself is clear enough to make the distinction between them.
One of the dictionary definition for append : Add to the very end
One of the dictionary definition for extend : Stretch out over a distance, space, time, or scope; run or extend between two points or beyond a certain point