5 – Make a thing


🎯 Learning Objectives

After this lesson you should be able to:

  • Use iteration (for statements) to iterate over strings of characters
  • Used variables to keep track of counts and sums
  • Combine key programming language features to develop solutions to meaningful problems
💬 Key Vocabulary
  • Input
  • Output
  • Variables
  • Assignment
  • Expressions
  • Selection
  • Boolean/logical expression (condition)
  • String operations
  • List
  • Index (within a list)
  • List item
  • List operations

📖 Introduction

In this lesson, you will:

  • Use variables to keep track of counts and sums
  • Use iteration (for statements) to iterate over strings of characters
  • Practise applying what you have learnt by attempting a mini project

📖 Starter activity (Sums 1)

Look at the following code

Question

What will be the output of this program when it is executed?

3

Tip  Read the assignment below as: increase the value of sum by the value of number.

sum = sum + number

📖 Starter activity (Sums 2)

Look at the following code

Question

What will be the output of this program when it is executed?

31

Tip  Read the assignment below as: increase the value of sum by the value of number.

sum = sum + number

📝 Activity 1 Accumulation: Sums in a for loop

Modify the Sums program so that a for loop is used to achieve the same results. Complete the tasks from your worksheet.

Download the worksheet and drag it to one side of your screen, then move this window with the Trinket window below to the the other side of your screen.

Activity 1 Task

Activity 1 Explorer Task

📝 Activity 2 for practise on strings

Use for to iterate over strings and do some counting and summing. Complete the tasks from your worksheet.

Download the worksheet and drag it to one side of your screen, then move this window with the Trinket window below to the the other side of your screen.

Activity 2 Task 1 Count the vowels

Activity 2 Task 2 Sum the digits

📝 Activity 3 Guided mini-projects

Select and complete at least one of these programming mini-projects:

Planetary quiz

Ask questions about the positions of the planets in the solar system.

Password safety

Check if a given password meets a set of common safety criteria.

Caesar’s cipher

Encrypt a text message using one of the oldest known cryptographic methods

ISBN

Every published book comes with an International Standard Book Number (ISBN). Check if a given ISBN is valid or not.

Download the relevant sheet to guide you through the project and code required.

Activity 3a Planetary Quiz

Activity 3b Password Safety

Activity 3c Caesar’s cipher

Activity 3d ISBN

📝 How confident do you feel?

Download the handout below and fill in the boxes for each programming concept on a scale from 1-4 based on how confident you feel about each concept. Then upload it to the Lesson 5 – Platinum task badge.

💬 Summary

In this lesson, you…
  • Used variables to keep track of counts and sums
  • Used iteration (for statements) to iterate over strings of characters
  • Practised applying what you have learnt by attempting a mini project.

In this unit you have…
  • Reviewed and practised previous knowledge and experience of Python from previous units
  • Used lists
  • Used Strings
  • Used iteration (loops)
  • Applied your python skills to creating a program for a defined task (mini-project)

🏅Badge it

🥈Silver Badge
  • Upload your completed Activity 1 – Accummulation code snip using a for loop to the Silver badge task on Bourne to Learn.
  • If you have completed the Activity 1 – Accumulation Explorer task then upload this to the silver badge task on Bourne To Learn.
🥇Gold Badge
  • Upload your completed Activity 2 – For practise on strings code snips for both Task 1 Count the vowels AND Task 2 Sum the digits to the Gold badge task on Bourne to Learn.
🥉Platinum Badge
  • Upload your completed Activity 3 – Mini project code snippet for one of the mini projects to the Platinum badge task on Bourne To Learn.