1 – Warm Up


🎯 Learning Objectives

After this lesson you should be able to:

  • Write programs that display messages, receive keyboard input, and use simple arithmetic expressions in assignment statements
  • Use selection (if-elif-else statements) to control the flow of program execution
  • Locate and correct common syntax errors
  • Create lists and access individual list items
💬 Key Vocabulary
  • Input
  • Output
  • Variables
  • Assignment
  • Expressions
  • Selection
  • Boolean/logical expression (condition)
  • List
  • Index
  • List item

Introduction

In this lesson, you will:

  • Brush up on your Python skills
    • You will walk through or write programs that display messages, receive keyboard input, and use arithmetic expressions in assignment statements
  • Use selection (ifelifelse statements) to control the flow of program execution
  • Create lists and access their items
In previous years, you…
  • used a text-based programming language (Python) to create programs that involved:
  • variables, operators and expressions
  • sequence, selection, and iteration
In this unit, you will…
  • use Python to develop programs that also involve:
  • lists
  • strings

📝 Starter Activity

  • Let’s see how much Python you remember from Year 7 & 8. Create a new folder in your Year 9 folder called Advanced Python.
  • Download the Word document below into the folder by right clicking and “Save link as…”, then fill out the answers before we go through them as a class.

📝 Activity 1 – Selection Recap

  • You will be using pair programming, with each member in a pair taking on a specific role:
    • Driver: Controls the keyboard and mouse
    • Navigator: Provides support and instructions
  • You will alternate between roles.
  • For this activity you need a selection structure (if-elif-else) when there are multiple branches and your program needs to select which one of them to follow.
  • Let’s extend this program together, to check the day and display whether it’s a weekday on not.
  • Note: The program uses an integer for each day of the week, ranging from 0 for Monday to 6 for Sunday.

📝 Activity 2 – How Long Till the Weekend

  • Download the Activity 2 worksheet and use the Python window below to extend your current program even further.

📖 Activity 3 – A List of Names

  • The names for the days of the week can be stored in a list .
  • Syntax: A comma-separated list of values (items), in square brackets.
  • In this example, the list items are strings (i.e. pieces of text), so they need to be in quotation marks.
  • A list is a kind of data structure.
  • Data structures are organised collections of data.
  • In the case of lists, data is organised in a sequence, with each item having a unique index, denoting its position in the list.
  • When the program is executed, this is what the list will look like in memory.
  • Each item has a unique index, denoting its position in the list. You can see the index of each item on the left from 0 to 6.

📝 Activity 4 – As Seasons Roll on By

  • Download the Activity 4 worksheet and use the Python windows below to complete the programs on the worksheet.
Task 1
Task 2
Task 3

💬 Summary

In this lesson, you…
  • Brushed up on your Python skills
  • Used selection (if-elif-else statements) to control the flow of program execution
  • Created lists and accessed their items

In the next lesson, you will…
  • Perform operations on lists

🏅 Badge it

🥈 Silver Badge
  • Upload your completed Activity 2 worksheet to the Silver badge task on Bourne to Learn.
🥇 Gold Badge
  • Upload your completed Activity 4 worksheet to the Gold badge task on Bourne to Learn.
🥉 Platinum Badge
  • Upload your completed Activity 4 worksheet to the Platinum badge task on Bourne to Learn as well as the Explorer task.