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
Your profits don’t wait — why should you? 🚀 Fast payouts with Maven Minis.
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]].
United States Trends
- 1. #WorldSeries 116K posts
- 2. Ernie Clement 8,341 posts
- 3. #SNME 75.5K posts
- 4. Hugh Freeze 3,177 posts
- 5. Auburn 10K posts
- 6. Ohtani 59.2K posts
- 7. Blue Jays 72.8K posts
- 8. Gimenez 14.5K posts
- 9. Bo Bichette 23.9K posts
- 10. Jesse Love 3,347 posts
- 11. Mateer 2,763 posts
- 12. Tate Sandell N/A
- 13. Max Muncy 2,736 posts
- 14. Jordan Marshall 1,374 posts
- 15. Nebraska 12.8K posts
- 16. Toronto 47.1K posts
- 17. Zilisch 5,243 posts
- 18. Shohei 41.2K posts
- 19. NC State 3,158 posts
- 20. Stoops 1,476 posts
Something went wrong.
Something went wrong.