C3.2 Read and alter existing code, including code that involves sequential and concurrent events, and describe how changes to the code affect the outcomes.

Activity 1: Repeating Patterns and Number Patterns


Ask students to read the following code:

Drum set. 7 blocks as follows:Events blocks stating “starts on when the green flag is clicked”.Look blocks stating “hide”.Looks block stating “show”.Sound block stating “play the sound of ‘drum bass’”.Events block stating “wait one second”.Sound block stating “play the sound ‘drum bass1’’’.
A saxophone.5 blocks as follows:Events block stating, “starts on when the green flag is clicked”.Looks block stating “hide”. Events block stating “wait, ‘two’ seconds.”Looks blocks stating “show”.Sound blocks stating, “play the sound ‘b sax’’’.
A drum set. 8 blocks as follows. Events block stating, “starts on when green flag is clicked”. Appearance block stating “hide”. Controls block stating “wait, ‘two’ seconds”.Appearance block stating “show”. Sound block stating “‘play the sound ‘b sax’’’.Controls block stating “l ‘wait one second’”.Sound block stating “‘play the sound ’b sax’”.Controls block stating “‘wait one second’”.
Saxophone.5 blocks as follows:Events blocks stating, “starts on when green flag is clicked”.Looks blocks stating “hide”. Controls blocks stating “wait, ‘two’ seconds”.Looks blocks stating “show”.Sounds blocks stating “play the sound ‘b sax’’’.

Ask the student to communicate to a partner or the class what will be the result of this code.

Ask the following questions:

  • Is the code a repeated or growing pattern?
  • Do you see any patterns?
  • What is the pattern?

Ask the student to explain what happens when you change the wait seconds.

Ask the student to modify the code to obtain a growing pattern.

Activity 2: Even and Odd Numbers


Ask the student to read the pseudo-code below:

Each line is displayed simultaneously.

Display the following number: 22

Display : This is an even number.

Display the following number: 3

Display : This is an odd number.

Display the following number: 15

Display : This is an odd number.

Display the following number: 60

Display : This is an even number.

Display the following number: 4

Display : This is an even number.

Display the following number: 17

Display : This is an odd number.

Ask the following question:

Is it possible to modify the code in order to sort and classify the numbers according to the following two classes: even numbers and odd numbers?