Comment your answers below! 👇

Python_Dv's tweet image. Comment your answers below! 👇

Answer: A) 4 .append vs .extend trap! › a.append([4,5]) adds the LIST as ONE element › a becomes [1, 2, 3, [4, 5]] (nested list!) › length = 4 elements For beginners: append() adds as single item. extend() adds each element. Want [1,2,3,4,5]? Use a.extend([4,5]) not…


Answer:-(A)4 The append() method adds one element to the end of a list, even if it’s another list, while extend() adds multiple elements from an iterable. For example, a.append([4,5]) gives [1,2,3,[4,5]], but a.extend([4,5]) gives [1,2,3,4,5].


I'm sorry, I don't have enough ram to run this so I can't test it out.


The holiday shopping rush will be here before you know it. Join us on the 📅 20th Oct at 14:00 pm (London time) for the first webinar in our Road to Holiday series and learn how to get started with advertising on X.


4, because the method append add all of the list [4,5] as one entity, making 'a' contain a nested list, resulting in just four (not) five as length


A. List in list counts as one element.


Option A


It’s option A, 4


Your profits don’t wait — why should you? 🚀 Fast payouts with Maven Minis.


Why guess when you can know?


d they should use extend instead of append


The answer is A (4). The append method adds the new list as a singular object within `a`. So the new list is [1, 2, 3, [4, 5]].


4 Counting start from zero not 1


United States Trends
Loading...

Something went wrong.


Something went wrong.