Python – List Methods

1. What are List Methods?

List methods are built-in functions that help us work with lists easily.

They help us to:

  • Add items

  • Remove items

  • Find items

  • Sort items

2. append() – Add Item at the End

Adds one item at the end of the list.

Example

fruits = ["apple", "banana"]
fruits.append("orange")
print(fruits)

3. insert() – Add Item at Position

Adds an item at a specific index.

Example

fruits.insert(1, "mango")
print(fruits)

4. extend() – Add Many Items

Adds all items from another list.

Example

more_fruits = ["grape", "papaya"]
fruits.extend(more_fruits)
print(fruits)

5. remove() – Remove by Value

Removes the first matching value.

Example

fruits.remove("banana")
print(fruits)

6. pop() – Remove by Index

Removes item by index.
If index not given, removes last item.

Example

fruits.pop(1)
print(fruits)

7. clear() – Remove All Items

Removes all items but keeps the list.

Example

fruits.clear()
print(fruits)

8. index() – Find Position of Item

Returns the index of an item.

Example

numbers = [10, 20, 30]
print(numbers.index(20))

9. count() – Count Item

Counts how many times an item appears.

Example

nums = [1, 2, 2, 3]
print(nums.count(2))

10. sort() – Sort the List

Sorts list in ascending order.

Example

nums = [3, 1, 4, 2]
nums.sort()
print(nums)

11. reverse() – Reverse List Order

Reverses the order of the list.

Example

nums.reverse()
print(nums)

12. copy() – Copy a List

Creates a copy of the list.

Example

new_nums = nums.copy()
print(new_nums)

13. Common Beginner Mistakes

❌ Expecting Method to Return List

new_list = nums.sort()

sort() returns None.

✔ Correct:

nums.sort()

❌ Removing Item Not in List

fruits.remove("kiwi")

✔ Fix:

if "kiwi" in fruits:
fruits.remove("kiwi")

14. Simple Practice Examples

Example 1: Add and Remove

colors = ["red", "blue"]
colors.append("green")
colors.remove("blue")
print(colors)

Example 2: Sort Names

names = ["Ravi", "Amit", "Sita"]
names.sort()
print(names)

Example 3: Count Items

marks = [80, 90, 80, 70]
print(marks.count(80))

15. Summary (List Methods)

✔ List methods make work easy
✔ Append, insert, extend add items
✔ Remove, pop, clear delete items
✔ Sort and reverse change order
✔ Copy keeps list safe

📘 Perfect for Beginner eBook

This chapter is ideal for:

  • Python beginner books

  • School & college students

  • Self-learners

If you want next, I can write:

  • Tuple Basics

  • Set Basics

  • Dictionary Basics

  • List Exercises

Just tell me 😊

You may also like...