# Micro Challenge # 40 – Finding sequencing errors

### 6 July 2020 - 3 minute read

Welcome to the fortieth of Altitude Foundation’s #MicroChallenges2020

What’s a Micro Challenge?

These challenges are short activities to help you develop, revise or refresh your coding skills, posted every Monday, Wednesday and Friday.

Micro Challenge #40

This week, we are exploring debugging and error-spotting.

The Challenge:

Today’s challenge focuses on sequencing – the topic of our very first MicroChallenge. Below are three sequences, one pseudocode, one Python and  one JavaScript with sequencing errors. Can you spot the error and rearrange the sequence so it makes sense?

1. A vote tallying programme (pseudocode)

vote tally a ← 0

vote tally b ← 0

IF press a, vote tally a ← add 1

IF press b, vote tally b ← add 1

Press A ← USERINPUT

OUTPUT “Thank you for your vote”

OR

Press B ← USERINPUT

OUTPUT “Thank you for your vote”

OUTPUT “The new tally is” + vote tally a + vote tally b

1. A sock matching game (JavaScript)

input.onButtonPressed(Button.A, function () {

if (Socks_1[index] == Socks_2[index_2]) {

basic.showString(“Matched pair“)

basic.showString(“Try Again“)

basic.clearScreen()

} else {

basic.showString(“Hurra!!!“)

basic.showString(“1st!“)

basic.pause(500)

basic.showString(“” + (Socks_1[index]))

basic.pause(500)

basic.showString(“2nd“)

basic.pause(500)

basic.showString(“” + (Socks_2[index_2]))

}

})

1. A programme which picks a song for you to sing to time washing your hands

from microbit import *

import random

“Any Dream Will Do”

“Take On Me”

“Do-Re-Mi”

“All Star”

“Never Gonna Give You Up”

“Mr Brightside”

“Africa”

]

while True:

if accelerometer.was_gesture(“shake”):

display.clear()

sleep(1000)

display.scroll(“1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19”)

display.show(Image.YES)

Review it: