Computer Science LearnITWithMrC ⛯ Year 7 Year 8 Year 9 GCSE
Responsive image

Looking at Lists

What am I Learning today?

I am learning how to use the data structure type of list
I am learning how to add and remove items from a list

Knowledge Organiser

×

Lesson

Task 1 - Getting Organised - PowerPoint Click to see more

  1. Set your Learning Objectives to red.

  2. We are going to save all of our work for this topic into this PowerPoint.

  3. To download the PowerPoint by clicking on the image below


  4. Save your PowerPoint as 'Programming 1'


Task 2 - Introducing Lists Click to see more

Coding with Lists

In computer science, a List is a programming structure that allows you to store data together in one place. We are going to look at a simple List that stores the days of the week.



Let's try it first in Edublocks.



Activity 1

  1. First let's gather the blocks we will need
  1. Now let's put them together.

Extension Activity 1

  1. Copy the code into your python editor and run it in there.
  2. Can you change the code so that you print out Wednesday?
  3. Can you add Saturday and Sunday to the list and print them both out?

Task 3 - Looping through Lists Click to see more

Wouldn't it be good if we could print out all of the items in our list in one go?

We can do that by using a simple loop. Copy the code below and run it to make sure it works:




Activity 2

  1. Copy and run the code above into your python window.
  2. Can you add all of the months in a year to the list and print them out?


Extension Activity 2

  1. Looking back to our lesson on for loops can you print out just the months March, April and May?
  2. if you use month.index("March") it will tell you the index number of 'March'.



In your Powerpoint put a screenshot of your code.


  • When you are finished don't forget to save your powerpoint

  • Task 4 - Adding and removing items in a list Click to see more

    One of the many things we can do with a list, when our program is running, is add and remove items from our list

    The code below shows you how to both add an item and remove an item from a list. Copy the code and complete the tasks:


    Copy the code and complete the tasks:

    Adding an item to a list



    Removing an item from a list


    Notice how we use the index value to access the value in our list


    Task 5 - Lesson review Click to see more

    Summing it all up

    Lets look at the learning outcomes and decide which one best describes our current level of understanding :

    Tick the one you feel is closest to your level

    Learning Outcomes I need to learn how to use the data structure type of list

    • I have a basic understanding of how I can use the data structure type of list with a little help from my teacher
    • I can show my teacher that I can use the data structure type of list without their help.
    • I can use the data structure type of list independently and I can also explain it to others and can complete any extension tasks I am given.

    🠜 Now update your learning objectivesClick on the Assessment image

    My Notes: Coding-p2

    Student_Comment_4 not found

    Task Notes/Comments - Add here Click to see more

    Comments/Notes

    Copyright © 2013 - 2024 LearnITwithMrC