Skip to content
Computer ScienceCBSE Class 11 · Lists

Python List Methods Class 11: append, extend, insert, remove, pop and sort with Output Tracing

Updated 17 October 2026 · Fact-checked

List methods change a list in place: append() and extend() add at the end, insert() adds at a position, remove() deletes the first matching value, pop() deletes by position and returns the item, and sort() and reverse() reorder the same list and return None. The function sorted() leaves the original untouched and returns a new list.

Follow the same list down the page: each method changes it in place, and pop() hands back the removed 9.

Illustration drawn for QuestionBuddy.

Understand List Methods: append, extend, insert, remove, pop, sort and Output Tracing (CBSE 11)

Adding items.

  • L.append(x) adds x as ONE item at the end. L.append([4, 5]) adds a list as a single item.
  • L.extend(seq) adds EACH item of seq at the end. L.extend("ab") adds the two items "a" and "b".
  • L.insert(i, x) puts x at index i and shifts the later items right. If i is larger than len(L) the item goes at the end.

Removing items.

  • L.remove(x) deletes the FIRST item equal to x; if x is absent it raises ValueError.
  • L.pop() removes and returns the last item; L.pop(i) removes and returns the item at index i. An empty list or a bad index raises IndexError.
  • del L[i] and del L[a:b] remove by position or slice but return nothing. L.clear() empties the list.

Searching and counting. L.count(x) gives the number of occurrences (0 if none). L.index(x) gives the index of the first occurrence and raises ValueError if x is absent.

Ordering.

  • L.sort() sorts in place (ascending); L.sort(reverse=True) sorts descending. It returns None, so L = L.sort() destroys the list.
  • L.reverse() reverses in place and returns None.
  • sorted(L) returns a new sorted list and leaves L as it was.

Built-in functions. len(L), min(L), max(L) and sum(L) work on lists of comparable items; sum() needs numbers. Methods that change the list in place return None, so printing their result prints None.

Example.

L = [3, 1, 2]
L.append(9)
L.insert(0, 7)
print(L)          # [7, 3, 1, 2, 9]
print(L.pop(), L) # 9 [7, 3, 1, 2]
L.sort()
print(L)          # [1, 2, 3, 7]

List Methods: append, extend, insert, remove, pop, sort and Output Tracing (CBSE 11): key facts

Add items
  • append(x) adds one item
  • extend(seq) adds each item
  • insert(i, x) adds at index i
All three change the list in place and return None.
Remove items
  • remove(x) by value, first match
  • pop(i) by index, returns item
  • del L[i] by index, no return
remove raises ValueError; pop raises IndexError.
Order items
  • sort() in place
  • sort(reverse=True) descending
  • sorted(L) new list
  • reverse() in place
sort() and reverse() return None.
Search items
  • count(x) number of times
  • index(x) first position
  • x in L True or False
index raises ValueError if x is absent.

How to answer List Methods: append, extend, insert, remove, pop, sort and Output Tracing (CBSE 11) questions

To trace list-method code, rewrite the list after every statement.

  1. 1Write the list as it is before the first method call.
  2. 2After each statement write the full new list; insert shifts later items to the right.
  3. 3For pop and remove note which item goes and what is returned.
  4. 4Remember that sort(), reverse(), append(), extend(), insert() and remove() return None.
  5. 5Write the printed line exactly, including brackets, commas and quotes of strings.

List Methods: append, extend, insert, remove, pop, sort and Output Tracing (CBSE 11) in real life

The idea, met in an everyday situation. Answer the question in your own words, then compare with the model answer. The one-line hook is what to remember.

A waiting list at a clinic

Suppose a clinic keeps the waiting patients as a list: q = ["Asha", "Dev", "Imran"]. A new patient Neha arrives, and the receptionist then calls the first patient.

Show the statements and the list after each step.

Try it first, then show the solutionSolution
  1. q.append("Neha") gives ["Asha", "Dev", "Imran", "Neha"].
  2. q.pop(0) removes and returns "Asha", leaving ["Dev", "Imran", "Neha"].

Answer: Final list ["Dev", "Imran", "Neha"]; pop(0) returned "Asha".

Memory hook: append joins the queue at the back; pop(0) serves the front.

Tricks to remember List Methods: append, extend, insert, remove, pop, sort and Output Tracing (CBSE 11)

Short memory aids. Say each one aloud once, then use it on a question the same day.

  • Append one, extend many

    append puts the whole argument in as one item; extend opens the argument and adds its pieces.

    Use it when: Predicting len() after adding a list or string.

  • None means in place

    If a method changes the list itself, it returns None, so never write L = L.sort().

    Use it when: sort, reverse, append, extend, insert, remove.

  • Pop returns, remove does not

    pop gives back the item it removes; remove just deletes by value.

    Use it when: Questions that print the result of pop.

List Methods: append, extend, insert, remove, pop, sort and Output Tracing (CBSE 11): solved examples

Ordered from board level to HOTS. Try each one before you open the solution.

Example 1: append versus length · 1 mark · MCQBoard level

What is the output?

L = [1, 2, 3]
L.append([4, 5])
print(len(L))

(a) 3
(b) 4
(c) 5
(d) Error

Try it first, then show the solutionSolution
  1. append adds the list [4, 5] as one single item.
  2. The list becomes [1, 2, 3, [4, 5]], which has 4 items.

Answer: (b) 4

Example 2: sort returns None · 2 marks · Short answerBoard level

Give the output and explain it:

L = [3, 1, 2]
M = L.sort()
print(L, M)
Try it first, then show the solutionSolution
  1. L.sort() sorts L in place, so L becomes [1, 2, 3].
  2. The method returns None, which is stored in M.
  3. print shows L and M separated by a space.

Answer: [1, 2, 3] None

Example 3: Statement-by-statement trace · 4 marks · Short answerHarder board level

Trace the code and give the output of the three print statements. (4 marks)

L = [10, 20, 30, 40, 50]
L.insert(2, 25)
x = L.pop()
L.remove(20)
L.extend([5, 5])
print(L.count(5), L.index(30), x)
print(sorted(L))
print(L)
Try it first, then show the solutionSolution
  1. After insert(2, 25): [10, 20, 25, 30, 40, 50].
  2. pop() removes 50 and x = 50: [10, 20, 25, 30, 40].
  3. remove(20): [10, 25, 30, 40]. extend([5, 5]): [10, 25, 30, 40, 5, 5].
  4. count(5) = 2; index(30) = 2; x = 50. First print: 2 2 50.
  5. sorted(L) is a new list [5, 5, 10, 25, 30, 40]; L itself is unchanged.

Answer: 2 2 50
[5, 5, 10, 25, 30, 40]
[10, 25, 30, 40, 5, 5]

Example 4: Removing inside a loop · 5 marks · Short answerHOTS / competency

A student wants to delete every 2 from the list and writes the code below. Trace it, give the output, and explain the fault with a correct method. (5 marks)

L = [2, 2, 3, 2]
for x in L:
    if x == 2:
        L.remove(x)
print(L)
Try it first, then show the solutionSolution
  1. Index 0: x = 2, remove deletes the first 2, giving [2, 3, 2].
  2. The loop moves to index 1, which now holds 3, so nothing happens; the second 2 slid to index 0 and was skipped.
  3. Index 2: x = 2, remove deletes the first 2 again: [3, 2].
  4. Index 3 is beyond the length 2, so the loop ends. Output [3, 2].
  5. Fault: the list changed while it was being traversed, so items were skipped. A correct method is: while 2 in L: L.remove(2), which leaves [3].

Answer: [3, 2]; modifying a list while traversing it skips items. Use while 2 in L: L.remove(2) to get [3].

Example 5: Edit a name list · 4 marks · Short answerHarder board level

A list names = ["Ravi", "Anu", "Kabir"] is given. Write statements to add "Zoya" at the end, insert "Mina" at position 1, remove "Anu", sort the list in descending order and print it with its length. Give the output. (4 marks)

Try it first, then show the solutionSolution
  1. names.append("Zoya") gives ["Ravi", "Anu", "Kabir", "Zoya"].
  2. names.insert(1, "Mina") gives ["Ravi", "Mina", "Anu", "Kabir", "Zoya"].
  3. names.remove("Anu") gives ["Ravi", "Mina", "Kabir", "Zoya"].
  4. names.sort(reverse=True) orders alphabetically in reverse: Zoya, Ravi, Mina, Kabir.
  5. print(names, len(names)).

Answer: ['Zoya', 'Ravi', 'Mina', 'Kabir'] 4

Where students lose marks in List Methods: append, extend, insert, remove, pop, sort and Output Tracing (CBSE 11)

The slips examiners see most often, and what to write instead.

  • Mistake: Assigning the result of sort()

    Expecting sort to return the sorted list.

    Wrong working

    L = L.sort(); print(L[0]) raises TypeError because L is None

    Right working

    L.sort(); print(L[0]) or M = sorted(L)

    Do this: In-place methods return None.

    Usually costs: 1 to 2 marks

  • Mistake: Using extend like append

    Not seeing that extend loops over its argument.

    Wrong working

    L = [1]; L.extend(5) # TypeError: int is not iterable

    Right working

    L.append(5) or L.extend([5])

    Do this: extend needs a list, tuple or string.

    Usually costs: 1 mark

  • Mistake: Assuming remove deletes by position

    Confusing remove(x) with pop(i).

    Wrong working

    L = [5, 6, 7]; L.remove(1) expecting 6 to go; it raises ValueError

    Right working

    L.pop(1) removes 6; L.remove(6) also removes 6

    Do this: remove takes a value; pop takes an index.

    Usually costs: 1 mark

Exam tips

  • Rewrite the whole list after each statement in a tracing question.
  • Write None in the answer when a question prints the result of sort() or append().
  • Name the error: ValueError for remove and index with a missing value, IndexError for pop.
  • Mention that sorted() returns a new list while sort() changes the original.

Practice questions on List Methods: append, extend, insert, remove, pop, sort and Output Tracing (CBSE 11)

Write each answer on paper first. Open the hint only if you are stuck, and the answer only when you have finished.

  1. Q1 · 1 mark · MCQBoard level

    Which list method removes an item and also returns it?
    (a) remove()
    (b) pop()
    (c) clear()
    (d) delete()

    Hint

    The return value matters.

    Answer

    (b) pop()

  2. Q2 · 1 mark · Assertion-reasonHarder board level

    Assertion (A): For a list L, the statement print(L.sort()) prints None.
    Reason (R): sort() arranges the items of L in place and returns nothing useful.
    (a) Both A and R are true, and R is the correct explanation of A.
    (b) Both A and R are true, but R is not the correct explanation of A.
    (c) A is true, but R is false.
    (d) A is false, but R is true.

    Hint

    Return value of in-place methods.

    Answer

    (a) Both A and R are true, and R is the correct explanation of A.

  3. Q3 · 3 marks · Short answerHarder board level

    Give the output and the length printed:

    L = [4, 8, 15]
    L.extend("ab")
    L.append("cd")
    print(L, len(L))

    (3 marks)

    Hint

    extend splits the string into characters.

    Answer

    extend adds 'a' and 'b' as two items; append adds 'cd' as one. Output: [4, 8, 15, 'a', 'b', 'cd'] 6

  4. Q4 · 4 marks · Short answerHOTS / competency

    Find the output of the code and name the error that stops the program.

    L = [7, 8, 9]
    print(L.pop(1), L)
    print(L.pop(5))

    (4 marks)

    Hint

    The second pop uses a bad index.

    Answer

    First print: 8 [7, 9]. The second pop(5) on a list of length 2 raises IndexError: pop index out of range, so nothing more is printed.

  5. Q5 · 4 marks · Short answerHarder board level

    Trace this code and give its output:

    L = [5, 3, 8, 3]
    L.reverse()
    L.remove(3)
    L.insert(len(L), 9)
    L.insert(-1, 7)
    print(L, L.index(7), max(L) - min(L))

    (4 marks)

    Hint

    insert(-1, x) places x before the last item.

    Answer

    reverse: [3, 8, 3, 5]; remove(3): [8, 3, 5]; insert at end: [8, 3, 5, 9]; insert(-1, 7): [8, 3, 5, 7, 9]. index(7) = 3; max 9 - min 3 = 6. Output: [8, 3, 5, 7, 9] 3 6

Test your recall

Answer in your head or on paper first, then open the card. Pulling an answer out of memory makes it stick far better than re-reading.

  1. 1.What does append() add?Show answer

    Its argument as one single item at the end.

  2. 2.What does sort() return?Show answer

    None; it sorts the list in place.

  3. 3.Which error does remove() raise for a missing value?Show answer

    ValueError.

  4. 4.How is pop() different from del?Show answer

    pop returns the removed item; del does not.

  5. 5.Which gives a new sorted list?Show answer

    sorted(L).

List Methods: append, extend, insert, remove, pop, sort and Output Tracing (CBSE 11): frequently asked questions

Can I insert at an index beyond the end?

Yes; insert(i, x) with i larger than len(L) simply places x at the end.

Does remove() delete all matches?

No, only the first match.

Does sorted() change the original list?

No, it returns a new list.