Year 9 · Algorithms and programming · original lesson pack
DASKEREL beta · internal AI review pending
Create and index a Python list
Open this lesson's library recordOfficial curriculum or provision guidance
DASKEREL wrote this teaching and practice using Oak's sequence as a source. View the source lesson at Oak National Academy. Oak has not endorsed this material. Check Oak's terms and separate rights for third-party works.
Learning outcomes
- Store several values in one ordered list
- Trace zero-based indices and an out-of-range access
Vocabulary: list · element · index · zero-based · IndexError
Retrieve previous learning
What does assignment do in Python?
Check: It binds a name to a value for later use in the program.
Learn the concept
A Python list holds an ordered sequence of values. In scores = [4, 7, 5], the first item is scores[0] = 4 and the third is scores[2] = 5. Lists allow a program to manage related values without inventing a separate variable for each one. The list can change after creation.
Zero-based indexing makes scores[3] invalid for this three-item list and raises IndexError. len(scores) returns 3, which is a count, not the last valid index. Negative indices count from the end: scores[-1] is 5, though an introductory trace may focus on nonnegative positions.
Write a table of index and value before running code. Use invented numeric examples; do not put names or personal scores into a class exercise. A teacher should observe a learner type, run and correct the program because a written trace alone does not show device competence.
scores = [4, 7, 5]
print(scores[0])
print(len(scores))The output is 4 then 3 on separate lines.
Run Python in DASKEREL
Use this editor alongside “Create and index a Python list”. Write or change a program, predict its output, then run it. Standard-library Python runs in an isolated browser frame and disposable worker. Each run starts fresh.
Preparing isolated runner…
Output and errors
Run your program to see its output here.
Ready for a longer exercise? Download a DASKEREL notebook for Google Colab. Colab opens separately and does not receive this editor's code automatically.
The Python runtime is downloaded from the pinned Pyodide distribution on first use. Code runs only in this isolated browser frame, with no DASKEREL account access. Programs stop after five seconds; output is capped. This tool does not save code or install packages. Avoid personal or sensitive data.
Worked model
- Create scores = [4, 7, 5] and label indices 0, 1, 2.
- Trace scores[0] to 4 and len(scores) to 3.
- Predict scores[3] raises IndexError before trying it in a supervised environment.
- Explain why a count of three does not imply index three exists.
Guided practice
What do colours = ['red', 'blue']; print(colours[1]) display?
Hint: The first element has index zero.
Check the guided answer
It displays blue. Index 1 is the second element in a zero-based list.
Independent practice
Write your own response to every question before viewing the model answers. Your writing stays in this page session; this activity does not submit, store or grade it. Avoid including private information.
Teacher observed practical evidence
A teacher must apply the school's risk assessment, allergy policy and any individual healthcare plan before the practical. Observe and record the criteria during supervised work. Written answers cannot certify practical safety or skill.
- Teacher observes an original program running in an approved Python 3 environment using invented data.
- Learner traces a test case, identifies and fixes at least one defect, and retains the code and test evidence.
- Learner explains the result and limitation without entering private data or running untrusted code.
Find and correct a misconception
“A list with four items has indices 1, 2, 3 and 4.”
Correction: Its nonnegative indices are 0, 1, 2 and 3.
Extend and reflect
Explain what scores[-1] means and compare it with scores[len(scores)-1].
Guidance: Both refer to the final element of a nonempty list; state the nonempty condition.
Where this lesson could lead · Computer Science GCSE → Daskerel Computing and AI
This lesson practises: Store several values in one ordered list. Algorithms, digital systems and safe practice support later software and technology work.
- Next school subject: Computer Science GCSE. Check the subject and examination board that fit your school.
- Later DASKEREL learning: Daskerel Computing and AI. Explore further study and build evidence from practical work.
- Later credential exploration: AWS Certified Developer - Associate is an example in this later specialism. Check current awarding-body requirements before planning an exam.
- Example career direction: Software Engineer. Explore organisations and local support.
This is an exploratory route, not a promise of admission, a qualification, certification eligibility or employment. Years 7–9 learning is an early foundation; any later credential may require substantial study, experience or local approval.