How do you add and remove items from a list?
Model answer
append adds one item to the end, insert adds at a position, extend adds many, remove deletes the first matching value, pop removes by index (default last) and returns it, and del deletes by index or slice. Use sorted() for a new sorted list and sort() to sort in place.
Learn this topic
Dictionaries, Tuples and Sets in Python in the course Python for Beginners: Learn to Code with Real Projects.
Sign in to add your own answer.