We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Extend is more suitable (and faster) when you need to "append" more than one thing at a time (any iterable).
Since I need to add two items (left and right), it is preferable.
N.B.: I could also have used a simple "+=" (which is infinitesimally faster), but this is more explicit and I prefer it for such things.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tree : Top View
You are viewing a single comment's thread. Return to all comments →
Extend is more suitable (and faster) when you need to "append" more than one thing at a time (any iterable). Since I need to add two items (left and right), it is preferable.
N.B.: I could also have used a simple "+=" (which is infinitesimally faster), but this is more explicit and I prefer it for such things.