Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0265

Python lists, tables and list algorithms

Create 1D and 2D lists, use indexes and iteration, apply list methods and write linear search and bubble sort.

Section 10 · Further programming and testing

Cambridge IGCSE Computer Science 0265 · 2029 syllabus · Version 1 · 10

Mapped to the Cambridge IGCSE Computer Science 0265 syllabus for exams in 2029. These original explanations and self-checks are independent study support, not Cambridge papers, official marks or grades. Practical programming is taught with worked code and trace tasks; an executable Python workspace and timed digital-exam simulation are not yet available.

Before you begin

  • Use the 2029 syllabus for this course. Cambridge specifies Python 3.10 or higher for programming and digital exams for both components. The syllabus currently identifies this route for 2029 only; confirm later-year availability with Cambridge and your school.

Work on paper. Try each question before revealing help, and explain why your method works.

Quick readiness check

Before python lists, tables and list algorithms, which statement is the safest starting point?

What you will learn

  • Define, initialise and traverse 1D and 2D lists
  • Use the specified list functions and methods
  • Write linear-search and bubble-sort algorithms

Lists store related values in order

A list holds multiple items under one variable name. Each item has an index, starting at zero. Use an index variable when reading or updating a particular position; use iteration to visit each item. A two-dimensional list can represent rows and columns, such as a table of scores.

Python provides sum(), max(), min() and len() for common list operations. append() adds an item at the end, insert() adds at a position, pop() removes and returns an item, sort() orders a list in place, and in/not in test membership.

Search and sorting need clear bounds

Linear search compares a target with each element until it is found or the list ends. Bubble sort compares adjacent items and swaps out-of-order values; repeated passes move larger values toward the end until no swaps are needed.

Use valid index ranges: if a list has n elements, its indexes are 0 through n−1. A two-dimensional list needs an outer row index and an inner column index. Test empty, one-item, repeated-value and already sorted cases when writing algorithms.

Pause and explain

Which habit best checks your understanding of python lists, tables and list algorithms?

Put the idea to work

Worked example

Read row 1, column 2 from grid = [[3,4,5],[6,7,8]].

Show the worked solution
  1. Indexes start at zero, so row 1 is the second row.
  2. Column 2 is the third item in that row.
  3. The value is 8.

Answer grid[1][2] is 8.

Try a topic test

Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.

Test this topic →

From guided practice to a new situation

Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.

1 · Guided

Given values = [4, 9, 2], find len(values), values[1] and sum(values).

Give me a hint

Use zero-based indexing and add each item for the total.

Compare my reasoning
  1. There are 3 items.
  2. Index 1 is the second item, 9.
  3. 4 + 9 + 2 = 15.

3, 9 and 15

Look for these in your work

  • Length
  • Index
  • Total
2 · Independent

Write a loop that counts how many values in marks = [38, 72, 65, 49] are at least 50.

Give me a hint

Initialise a counter and test every value.

Compare my reasoning
  1. Set passed = 0.
  2. For each mark, if mark >= 50, add one.
  3. The qualifying values are 72 and 65, so print 2.

passed = 0 for mark in marks: if mark >= 50: passed += 1

Look for these in your work

  • Counter set
  • All items visited
  • Boundary rule applied
3 · Transfer

Perform one bubble-sort pass on [5, 1, 4]. Explain why one pass does not guarantee the whole list is sorted.

Give me a hint

Compare the first two, then the next adjacent pair.

Compare my reasoning
  1. 5 and 1 swap: [1, 5, 4].
  2. 5 and 4 swap: [1, 4, 5].
  3. This example happens to finish sorted, but longer lists can need more passes; stop when a complete pass makes no swaps.

After this pass: [1, 4, 5]; in general repeat passes until no swaps occur.

Look for these in your work

  • Comparisons shown
  • Pass result
  • General stopping rule

Common mistakes

  • Using one-based indexes.
  • Calling sort() as though it returns a new sorted list.
  • Accessing an index equal to the list length.
Recall without your notes

What can you explain now?

What is the index of the first list item?

Compare with the explanation

0

Python list indexing starts at zero.

After trying it yourself, choose your next review. This is your self-assessment.

Your review choice appears on Today. Sign in to sync it across devices.

Make it stick

How do zero-based indexes, iteration and list methods support searching and sorting?

If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.

Keep learning Computer Science

Course scope and assessment

All 11 syllabus topics link to 33 original lessons. Each lesson includes worked teaching, a check with explanation and guided, independent and application practice. This is mapped teaching, not evidence of exam readiness, teacher approval or a Cambridge grade. Cambridge specifies two externally assessed digital exams; StudyForA does not yet provide full timed digital-paper simulations or an executable Python 3.10+ workspace for practical programming. The currently published syllabus is for 2029; later-year coverage is not claimed.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.