My daily routine

daily-routine

Learning Objectives


When you write lines of code, there are three ways you can control the order these lines will be executed by the computer:

  1. Sequencing: This means that the computer will run your code in order, one line at a time from the top to the bottom of your program. It will start at line 1, then execute line 2 then line 3 and so on till it reaches the last line of your program.
  2. Selection: Sometimes you only want some lines of code to be run only if a condition is met, otherwise you want the computer to ignore these lines and jump over them. This is achieved using IF statements. e.g. If a condition is met then lines 4, 5, 6 are executed otherwise the computer jumps to line 7 without even looking at line 4,5 and 6.
  3. Iteration: Sometimes you want the computer to execute the same lines of code several times. This is done using a loop. There are three types of loops: For loops, while loops and repeat until loops. That’s handy as it enables you not to have to copy the same lines of code many times.

Let’s Get Coding


For this task we are going to write a program that uses sequencing, selection and iteration all in the same program! Our program will be used to print our daily routines on screen over a full week. Look at the code below and try to make sense of how it works. Can you spot where and how sequencing, iteration and selection are used in this code?

Your Task


Your task is to tweak this code to customise your daily routines. Add to it some of the activities or clubs you go to. For instance:

  • Are you going swimming on Tuesdays?
  • Do you play football on Saturdays?
  • Do you go to a Youth Club on Thursdays?
  • Do you play music on Fridays?
  • Is Friday Fish and Chips day?
Share Button
Posted in Computer Science, Python - Beginner, Python Challenges Tagged with: , ,

Our Latest Book

Follow this blog