Business and technology qualifications, Levels 3-6, in Brussels. Explore qualifications
Portal login
Diploma in Higher Education Studies

Repeating code: while loops

HES 211 · Introduction to Programming with Python — Week 7 of 16

CourseHES 211
Week7 of 16
SemesterII
TutorOnline in the course chat

This week’s topics

Repeating code: while loops

  1. Loops that stop on a condition
  2. Avoiding endless loops

What you will be able to do

  • 2.2 Implement sequence, selection, and iteration structures.

Activity

Write a number-guessing game.

Study materials

Further resources

  • Introduction to Python Programming, 5.1: While loop · PDF · OpenStax Introduction to Python Programming (2024), 5.1: while loops that stop on a condition, pp. 115–117 · for registered students
  • Introduction to Python Programming, 5.4: Break and continue · PDF · OpenStax Introduction to Python Programming (2024), 5.4: controlling loops and avoiding endless loops, pp. 127–129 · for registered students
  • Think Python, ch. 7: Iteration · PDF · Downey, Think Python 2e (Green Tea Press), ch. 7: the while statement and break, pp. 63–70 · for registered students
  • Understanding loops: what are the misconceptions of lower-secondary pupils? · Open-access article · Vaníček et al. (2023), Informatics in Education. Common misconceptions about loops, including when a loop stops. · for registered students
Materials marked “for registered students” open in the student portal, which is set up as soon as you receive final acceptance.
Course chat

Admitted students ask questions on this week’s page in the student portal: an AI assistant trained on the course answers first, and during the course’s timetabled classes Connect to your tutor brings your tutor into the chat, who may start a call if needed.

Open this week in the portal
Course plan
  • Week 1: What is programming? High- and low-level languages
  • Week 2: Your first Python program
  • Week 3: Variables, data types and constants
  • Week 4: Input, output and calculations
  • Week 5: Making decisions: if, elif and else
  • Week 6: Repeating code: for loops
  • Week 7: Repeating code: while loops
  • Midterm: Midterm evaluation
  • Week 9: Functions: reusable code
  • Week 10: Lists
  • Week 11: Looping through data; tuples and dictionaries
  • Week 12: Finding and fixing errors
  • Week 13: Tracing and testing a program
  • Week 14: Mini project: a small program step by step
  • Week 15: Review and coursework completion
  • Final: Final assessment and submission
Back to the course
Scroll