VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

SEAB MOE SEC 2027 G3 Computing K349 | Why Does My Child Include the Wrong Last Item in a Python Slice?

Educational illustration of a laptop, programming diagrams, notebook and network model

If your child expects Python to return the first list item using index 1, or expects a slice to include its final bound, the missing skill is understanding two separate boundary conventions. Python lists and strings are indexed from zero, while a slice includes its start but excludes its stop. For the invented list [12, 15, 18, 21], the expression scores[1:3] returns [15, 18], not three values. This distinction is examinable in G3 Computing K349.

The 2027 SEC G3 Computing K349 syllabus includes a two-hour written Paper 1 worth 60% and a two-hour-thirty-minute lab Paper 2 worth 40%. Its Python quick reference and programming content include indexing, slicing, iteration, debugging and test cases. Parents can practise accurate predictions on paper before a pupil uses the school’s Python and JupyterLab environment, so students learn the meaning of each index rather than memorise one script.

  • Zero-based indexing: item one is found at index 0.
  • Start-inclusive slice: the item at the start index is included.
  • Stop-exclusive slice: the item at the stop index is excluded.
  • Different boundary outcomes: out-of-range indexing can error; a valid empty slice may not.
  • Check expected outputs: executable code can still choose the wrong data.
  • Transfer the skill: apply the same reasoning to new lists, strings and loops.

A teenager may use Python confidently on a familiar worksheet and still make an off-by-one error on a changed dataset. This is one conceptual boundary mistake, not evidence that all their programming knowledge is missing.

Every list, string and code expression below is original learning material, not an official specimen question or an assessed student’s program.

Ten chapters and five reading routes

1. The first index is zero, not one In Python, sequence indexing begins at zero. For an original list named scores containing [12, 15, 18, 21], scores[0] is 12 and scores[1] is 15. A pupil who assumes that the bracketed number means first item, second item, third item in everyday counting can return the wrong value despite writing valid Python syntax.

CHAPTER 1 OF 10

The distinction is conceptual rather than a memorisation trick. An index is the location used by Python; an ordinal description such as the third item is the position a person may use in ordinary speech. The third item in this list has index 2.

Check the example against the rule

Parents can ask the child to write the indices 0, 1, 2, 3 above the four values before running any code. Once the mapping is clear, change the items to different numbers and test whether the pupil can still identify the desired element.

Back to contents · Next chapter

2. Slices use a start and an exclusive stop A slice such as scores[1:3] extracts the items at indices 1 and 2. It stops before index 3, so it returns [15, 18] in the original example. This is not the same as selecting inclusive positions 1 through 3 in ordinary language.

CHAPTER 2 OF 10

In a two-bound slice, the start index is included and the stop index is excluded. The slice scores[0:2] returns the first two items [12, 15], while scores[2:4] returns [18, 21]. The stop can equal the sequence length when slicing; that does not imply that the same index can be used to retrieve a single element.

Check the example against the rule

Ask why scores[3] returns the final element 21 but scores[4] would raise an IndexError in this four-item list. Then explain why scores[1:4] can still return three elements safely. These are different operations.

Back to contents · Next chapter

3. Check the exact K349 assessment scheme The official 2027 G3 Computing K349 syllabus requires Paper 1, a two-hour written examination worth 80 marks and 60%, and Paper 2, a two-hour-thirty-minute lab examination worth 70 marks and 40%. Paper 1 includes multiple-choice, short-answer, matching, cloze and structured questions, and can cover five modules.

CHAPTER 3 OF 10

Paper 2 uses spreadsheets together with Python and JupyterLab to assess algorithm and programming work. Candidates must save and submit the required electronic files, and a Python quick reference is provided. The syllabus explicitly includes string and list indexing and slicing in Module 2, while its quick reference shows both operations.

Check the example against the rule

This guide is about one language operation, not a claim that every Python assessment question will use a four-element list. Algorithmic understanding should transfer to unfamiliar data, loops and instructions.

Back to contents · Next chapter

4. A complete worked table for one original list Use the invented list scores = [12, 15, 18, 21]. The expression scores[0] is the first value, 12. The expression scores[2] is 18. The expression scores[1:3] produces a new list containing 15 and 18. The expression scores[2:4] produces 18 and 21.

CHAPTER 4 OF 10

The table can also compare scores[:2], which returns the first two items, with scores[2:], which returns everything from index 2 to the end. Leaving an endpoint empty changes which boundary is used but does not reverse the zero-based convention.

Check the example against the rule

Ask the pupil to predict the results on paper before typing. Running a program can verify a prediction, but the educational aim is to explain why the result occurs rather than learn through random trial and error.

Back to contents · Next chapter

5. An IndexError is different from a valid empty slice If the original list has four items, scores[4] attempts to retrieve a single element at a non-existent index and ordinarily raises an IndexError. By contrast, the slice scores[4:4] yields an empty list because its start and stop are equal and no elements lie in the requested interval.

CHAPTER 5 OF 10

The student should not treat every empty result as a syntax error or every out-of-range access as a failure of the entire computer. The operation’s semantics determine the result. A valid empty slice and an invalid individual index are separate cases.

Check the example against the rule

This is useful for debugging because a program can have perfectly valid syntax while choosing the wrong index. Ask the learner to distinguish syntax errors, run-time errors and logical mistakes rather than label everything simply incorrect.

Back to contents · Next chapter

6. A loop can reveal the same off-by-one misunderstanding A simple conceptual loop over range(4) uses index values 0, 1, 2 and 3. It does not include 4. This matches the valid individual indices of a four-element list when those indices are used deliberately. Python’s range endpoint is also exclusive.

CHAPTER 6 OF 10

A novice may try to process the entire four-item list using an inclusive loop that attempts index 4. That can create an out-of-range access. An alternative, often clearer when indices are not needed, is to iterate directly over the items, using for item in scores.

Check the example against the rule

The official Python quick reference includes for loops, range and direct iteration. A parent can ask whether the code actually needs positions or simply the values, helping the pupil choose the simpler correct structure when appropriate.

Back to contents · Next chapter

7. Strings use the same family of sequence ideas For the invented string "water", character positions begin at zero: w is index 0 and a is index 1. The slice "water"[0:3] returns "wat", and "water"[2:5] returns "ter". The end index is excluded just as in list slicing.

CHAPTER 7 OF 10

The child should recognise that lists and strings are distinct data types but can share indexing and slicing syntax. A string slice returns a string, while a list slice returns a list. Do not claim that every sequence operation is otherwise identical for all types.

Check the example against the rule

Use a new short original word and ask the learner to identify the first three characters and the final two. If the answer still includes an extra character at the stop index, the same misunderstanding remains.

Back to contents · Next chapter

8. Test the expected result and not just whether code runs A program may execute without an exception yet extract the wrong portion of data. If the task asks for the first two scores, scores[1:3] runs successfully but returns the second and third items. The failure is a logic error relative to the requirement rather than a failure of syntax.

CHAPTER 8 OF 10

Ask the pupil to write the intended output before choosing a slice. For the first two elements of [12, 15, 18, 21], the target is [12, 15]. Then compare different slice bounds against that expected result. This is more efficient than guessing parameters until the console output looks familiar.

Check the example against the rule

K349 explicitly assesses testing and debugging as well as programming, including trace tables, normal and boundary test cases. Those broader competencies reinforce why understanding precise index and stop conditions matters.

Back to contents · Next chapter

9. Four-week parent-supported indexing plan Week 1: attach numeric indices to short invented lists and distinguish an item number from its Python index. Week 2: practise start-inclusive, stop-exclusive slices using small labelled boxes and verify predicted results through the teacher’s authorised environment.

CHAPTER 9 OF 10

Week 3: contrast individual indexing with slicing at the list boundary and identify an expected IndexError versus an empty slice. Week 4: use an unfamiliar string and list to explain which values an expression will return, independently of a worked example.

Check the example against the rule

Do not write or modify an assessed lab submission for the child. A short paper dry run and one safe practice script are sufficient to expose the conceptual problem; the full lab workflow remains school-supervised.

Back to contents · Next chapter

10. Eight-week bridge to wider G3 Computing Weeks 1–2: secure sequence types, variables, operators and manual tracing of small algorithms. Weeks 3–4: practise selection and iteration, including when to use direct element iteration versus index access. Weeks 5–6: revisit input validation, test-case design and spreadsheet reasoning under the published five-module syllabus.

CHAPTER 10 OF 10

Weeks 7–8: connect Paper 1 problem analysis with short Paper 2 programming tasks and reliable saving of electronic outputs, according to school guidance. G3 Computing is not only Python: it includes computing fundamentals, algorithms and programming, spreadsheets, networking and social impacts.

Check the example against the rule

When the pupil makes a mistake, diagnose whether they confused the first index, the exclusive stop, a missing value or the requested output. One precise correction followed by a new example is better than many nearly identical worksheets.

Back to contents

Questions parents frequently ask

Does Python start list indexing at one?

No. The first item is at index 0.

What does scores[1:3] return for [12,15,18,21]?

It returns [15,18] because index 3 is excluded.

Does scores[4] retrieve the fourth item?

No. A four-item list has individual indices 0 through 3, so this would raise IndexError.

Can a slice stop at length four?

Yes. scores[2:4] is a valid slice returning the final two items.

Why can an empty slice be valid?

A slice such as scores[4:4] selects no elements and yields an empty list.

Does Python range(4) include 4?

No. It generates 0, 1, 2 and 3.

Are strings also zero-indexed?

Yes. Python supports character indexing and slicing for strings.

Is a wrong but executable slice a syntax error?

No. It may be a logic error if the output does not match the task.

How much is K349’s lab paper worth?

Forty per cent, in a two-hour-thirty-minute examination.

What is the first diagnostic question?

Ask which exact items the result should contain, then map their indices before typing.

Official syllabus and relevant eduKateSG guides

The official 2027 SEAB G3 Computing K349 syllabus and 2027 G3 subject directory establish the examined scope. Read the distinct Python testing and boundary-case guide or the full G3 computing playbook for other skills. General study support is available through eduKate Singapore.