Review, explain, practice

Study guide: Build Programs with Text and Lists

For text="planet" and values=[4,8,3], find text[1:4],values[1] and len(values). Explain the excluded slice endpoint.

Download the grade study pack

Ideas to explain in your own words

Useful vocabulary

index
A position number in a sequence.
slice
A selected segment with a stated start and stop.
list
An ordered collection of items.

Watch your reasoning

A worked review example

For "boat", label 0:b, 1:o, 2:a, 3:t; index 0 selects "b". For the distinct text "peach", label 0:p, 1:e, 2:a, 3:c, 4:h; index 2 selects "a". Read the original sequence without sorting and distinguish an index from its character value. Both supplied indices exist. An out-of-range request would need a separately specified error response rather than an invented character. The list [2,5,9] has three outer elements, so its length is 3, rather than their sum 16. The distinct nested list [[8],[4,6,2],[1,5]] also has three outer elements: the first, second and third inner lists. The six numbers inside those lists do not change the outer length to six. Counting outer elements differs from recursive counting. An empty collection has no outer elements; identify which collection is being measured.

Make a practice plan

  1. Make a four-row summary, one row for each lesson, with its computing idea and one worked decision.
  2. Explain one tempting mistake using the actual supplied example.
  3. Complete the new unit review before consulting its explanations.
  4. Try the transfer task on paper and compare your evidence against the model response.