Langkau ke kandungan

    List Lane

    Lists Umur 8–10

    Store lots of items under one name, find them by position, and add, delete, insert and replace items.

    • Umur 8–10
    • 3 misi
    • Permulaan → Semakin mahir → Cabaran

    A variable holds one value. A list holds many, in order, under a single name — every score in a game, every name in a class. On List Lane, Year 4 coders find items by position and change lists step by step.

    Apa yang akan dipelajari anak anda

    • Know that a list stores many items in order under one name
    • Find an item by its position, and say how long a list is
    • Add, delete, insert and replace items
    • Understand that a loop can do something to every item in a list

    Position matters

    Each item has a position. In these quests, as in Scratch, the first item is item 1. Many text languages count from 0 instead — a famous source of bugs, and worth knowing about.

    Lists and loops

    Lists and loops are best friends. “For each item in the list, say the item” works whether the list has three items or three thousand. That is why programmers reach for a list instead of lots of separate variables.

    Contoh soalan

    Berikut ialah beberapa soalan seperti dalam misi pertama. Bolehkah anda menjawabnya?

    1. 1. What is a list in coding?

      • A single number
      • A broken program
      • A kind of loop
      • A group of items stored in order under one name
      Tunjuk jawapan

      Jawapan: A group of items stored in order under one name. A list keeps many values together, in order.

    2. 2. A list holds: sun, moon, star. Which item is “moon”?

      • Item 3
      • Item 1
      • Item 2
      • Item 4
      Tunjuk jawapan

      Jawapan: Item 2. Moon is second in the list.

    3. 3. A list holds: red, blue, green, pink. How long is the list?

      • 1
      • 5
      • 4
      • 3
      Tunjuk jawapan

      Jawapan: 4. There are four items, so its length is 4.

    Tip untuk orang dewasa

    • Write a real list — shopping, favourite films — and number the items.
    • Play “list commands”: add to the end, delete item 2, insert at position 1.
    • In Scratch, make a list and try the add, delete and insert blocks.