🎯 Learning Objectives
- Use iteration (for statements) to iterate over list items
- Perform common operations on lists or strings
💬 Key Vocabulary
- Iteration
- index
- string operations
- Boolean/logical expression (condition)
- list item
- list
- list operations
📖 for loops: Syntax and use

for loops are convenient for iterating over the items of a list.
Note: for loops can be used for iterating over any sequence of elements, e.g. strings.
📖 Lipogram

The 1939 novel Gadsby, by Ernest Vincent Wright is a lipogram (missing a letter).
A note at the end of the book claims: “Not a word containing the letter ‘E’ has appeared in this story of over 50,000 words.”
We will make a program to check this claim.

This code retrieves the entire text of Gadsby and stores it as a list of words (wordlist).
Note: The textfile module and the words function are not standard Python components.
Follow your teacher to make a program that checks the claim that no words containing ‘E’ are to be found in the book.
📝 Level 1/2 – English words
Use a for loop to iterate over a list containing thousands of English words, to 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 below the the other side of your screen.
Task 1
Task 2
Task 3
📝 Level 3 – Heartbeats
So far, you have used for to iterate over lists of text. In this activity, you will iterate over lists of numbers.
Use the worksheet below to process real ECG (electrocardiogram) data from a medical database, to detect heartbeats.

💬 Summary
In this lesson, you…
- Use iteration (for statements) to iterate over list items
- Practise using common operations lists and strings
Next lesson, you will…
- Use variables to keep track of counts and sums
- Use iteration (
forstatements) to iterate over strings of characters - Develop guided mini–projects that will help you apply what you have learnt
🏅 Level Up
🥇 Level 1
- Upload your completed Level 1/2 – English Words task 1 to the assignment on Teams.
🥈 Level 2
- Upload your completed Level 1/2 – English Words task 2 to the assignment on Teams.
🥉 Level 3
- Upload your completed Level 3 – Heartbeats task to the assignment on Teams.