# Refining Algorithms

### Lesson Instructions

1. Key Information and content - all you need to do here is watch and listen. We recommend you take some notes for this one!

2. Learning activity - You are to complete the activity, refining the program that already exists to add the new features described.

3. Consolidation - these are past exam question and are for deliberate practice to check your understanding.

# Task - Refining Algorithms Activity Refining Algorithms Activity

# Task - Exam Questions - Deliberate Practice Exam Questions - Web

## Mark Scheme

### Question 1

e.g.

• Position = Position + 1 should be changed

• ...so the increment is a random number

• The random number should be relatively small

• ...so the game remains interesting

• The end condition of the loop should be changed to UNTIL Position > 100 / check if position > 100 and if so change to 100

• ...as the position may not reach exactly 100 due to the random number.

• seed/initialise random number generation

• ...so that numbers generated appear random

Mark in pairs

### Question 2

• Initialises total as 0 and prints out total at the end (as per original program)

• Uses iteration e.g. FOR / WHILE

• ….that repeats 6 times

• ….correctly adds up values using the loop index

e.g.

total = 0

for x = 0 to 5

total = total + scores[x]

next x

print(total)