Computer Science LearnITWithMrC ⛯ Year 7 Year 8 Year 9 GCSE
0 results for
ICT
Responsive image

Lesson 5 - Iteration - loops

0 results forGuest
Overview
Flight Path
Learning Objectives
0 results forGuest
IDSkill_name
 6 I can use iteration (looping) with a basic understanding

🏁 Learning Objective 12 :- I can use iteration (looping) with a basic understanding


Iteration

There are two ways in which programs can iterate or ‘loop’:
  1. count-controlled loops (for loops)
  2. condition-controlled loops (while or repeat loops)

We are going to look at while loops.

While loop example


Blast Off

Copy the code below to print out the blastoff countdown

Flight Path

Run you code, does it output the blastoff countdown?

If it does then try the tasks below.


Tasks

  • Change the value of n and the calculation of n (n = n - 1) so that your output looks like the examples below:
  • Example 1

    
    7
    5
    3
    Blastoff
    1
    
    >>>
    
    

    Now try the harder exercises where we are counting up?

    Extension

    Example 2

    
    0 
    1 
    3
    6
    I am counting up
    10
    >>>
    

    Example 3

    
    3 
    7
    12
    18
    25
    I am counting up
    33
    >>>
    

Understanding Activity

Click on the bitesize button to learn all about loops.

Complete the Bitesize test at the end when you have finished.



0 results forGuest
Recent Comments

Teacher Date: 2021-04-21


Guest