Week 6: List Methods and Mutation

223 words
1 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Week 6: List Methods and Mutation > **Course:** Jan 2026 - Python > **Focus:** How list methods behave, what they return, and when they fail. --- ## 1.

Visual strip

Relevant recall pieces for this note

Open gallery

Week 6: List Methods and Mutation

Course: Jan 2026 - Python Focus: How list methods behave, what they return, and when they fail.

1. Core idea

Week 6 is mostly about list method contracts: what mutates the list, what returns a value, and what raises an error.

What to remember

  • append() mutates in place and returns None.
  • extend() expects an iterable.
  • Slicing returns a new list.
  • index() returns an integer position.
  • remove() mutates in place and returns None.
  • pop() returns the removed element.

2. Common traps

  • A method returning None does not mean it did nothing.
  • l.extend((5)) is wrong because (5) is just an integer in parentheses, not a tuple.
  • Missing items can raise exceptions.
  • Do not confuse "type of result" with "effect on the list."

3. Speedrun pattern

When you see a Week 6 question, ask:
  1. Does this method mutate the list?
  2. Does it return a new value, None, or an error?
  3. Is the question about a present item or a missing one?

4. Micro revision

  • Mutation: append, extend, remove, sort
  • Value-returning: pop, index
  • Copy-producing: slicing

Assignment anchor

Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.