About this video

This beginner Python lesson adds items to an existing list, using a camping supplies list that is missing toilet paper and a bidet as the running example. The host introduces methods as tools associated with an object, then demonstrates append: calling supplies.append with a single string adds that one item to the very end of the list, and append cannot add two items at once. To add multiple items, he shows extend, which takes another list and adds all its items to the end, and notes that reassigning supplies to supplies plus another list achieves the same result without a method. He then covers placing items somewhere other than the end with insert, which takes an index and a value: insert at index 0 puts the bidet at the beginning. He works through negative indexes for insert, explaining that using -1 inserts second-to-last rather than last, unlike reading the last element with index -1, and -2 would place an item third from last. The lesson ends by previewing practice resources and a next episode about removing items from lists.

Key takeaways

  • A method is a built-in tool associated with an object/class; list methods let you change a list programmatically instead of editing it manually.
  • append adds exactly one item to the end of a list, e.g. supplies.append(’toilet paper’).
  • extend adds multiple items at once by passing another list, and supplies = supplies + [new list] does the same thing.
  • insert takes an index and a value, so insert(0, ‘bidet’) places an item at the beginning of the list.
  • Negative indexes behave differently for insert than for reading: insert with -1 puts the item second-to-last, not last.

Episode details: published April 29, 2022 · 11:46 long. Summary written by Self Growth Videos from the episode itself. Business results and any income figures mentioned are NetworkChuck’s own claims, shared for education — they are not typical or guaranteed.


← Previous: we’re out of IP Addresses….but this saved us (Private IP Addresses) · Next: this BASH script will make you a MILLIONAIRE →

All NetworkChuck videos · NetworkChuck profile · NetworkChuck on YouTube

Sister brand · Vacation Club Promo

All-inclusive resort stays from $435

Qualified couples: promotional Mexico and Caribbean packages at real resorts. Short presentation during your stay — enjoy the rest of the trip.

Qualifications apply · presentation during stay · no purchase required

Subscribe YouTube Suggest