Track 6 · Lesson 2 of 12
Changing lists: methods and mutability
Grow, shrink and reorder lists with append, insert, remove, pop, extend and sort, and know when a list is changed in place.
You will be able to
- Add items with append, insert and extend, and remove them with remove and pop
- Explain what it means that a list is mutable and that a method changes it in place
- Choose between list.sort() and sorted() and avoid the None trap
- Write functions that build a new list instead of changing their input
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.