New
New
Lesson 2 of 6
  • Year 9

Python list operations

I can add and remove items and sort data held in a list.

Lesson 2 of 6
New
New
  • Year 9

Python list operations

I can add and remove items and sort data held in a list.

Lesson details

Key learning points

  1. List methods can be used to perform operations on lists such as to add, remove and insert items.
  2. A list is a dynamic data structure, meaning the length of a list is the number of values it currently stores.
  3. A list can be sorted using a list method to aid processing.

Keywords

  • Append - adding to an existing data structure

  • Remove - taking an item away from an existing data structure

  • Sort - arranging data into a meaningful order

  • List method - a built-in function that will perform an operation on a list

Common misconception

Once an item is added to a list it is fixed in to the structure of the list and it cannot be altered.

Items can be removed, inserted and amended in a list using list methods. These methods change the structure of the list. Values of items can also be updated.


To help you plan your year 9 computing lesson on: Python list operations, download all teaching resources for free and adapt to suit your pupils' needs...

List structures can be modelled using props. Playing cards are a good example as the cards can be arranged in order to visualise where the data is stored and in what order.
Teacher tip

Equipment

Pupils will need access to a device that can edit and run Python programs. Examples in this lesson use the RPF Code Editor https://oak.link/python-editor

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

Prior knowledge starter quiz

Download quiz pdf

6 Questions

Q1.
is used when there is more than one possible path for a program to follow.

Correct Answer: selection

Q2.
Match the keyword to the definition.

Correct Answer:selection,used when there is more than one possible path for a program to follow

used when there is more than one possible path for a program to follow

Correct Answer:list,a collection of data in a particular sequence

a collection of data in a particular sequence

Correct Answer:data structure,an organised way to store data for easy use

an organised way to store data for easy use

Correct Answer:index,the location of an item or element in a list or string

the location of an item or element in a list or string

Q3.
What is the correct way to access the first item in a list called names?

Correct answer: `names[0]`
names[1]
names{0}
names(0)
names(1)

Q4.
What letter can you type in to join text and the values held by a variable in a print statement?

j
c
Correct answer: f
p

Q5.
What is an IndexError?

when you have too many items in a list
Correct answer: when you refer to an index that does not exist in a list
when you have too few items in a list
when you have two of the same index values in a list

Q6.
A list is a d data structure that can grow or shrink as you add or remove items.

Correct Answer: dynamic, ynamic

Assessment exit quiz

Download quiz pdf

4 Questions

Q1.
Which list method can be used to add an item to the end of a list?

list.insert()
list.add()
Correct answer: `list.append()`
list.remove()

Q2.
Which list method can be used to remove the last item from a list if you do not know the index of the last item?

Correct answer: `list.pop()`
list.remove()
list.delete()
list.append()

Q3.
The operation `list.sort(reverse=True)` sorts a list in order

Correct Answer: descending

Q4.
What list method is used to find the index of a specific item?

list.find(item)
list.search(item)
Correct answer: `list.index(item)`
index.find(item)