Operation Early Finish
_____
_______
0 / 12 LOCKS OPEN
LOCKDOWN

Operation Early Finish

It is the last lesson before the holidays. Somebody has locked down the Computing corridor and Mr Docherty is stuck behind three locked doors. Every lock takes a code, and every code comes from a Python program that you write. Get everybody out.

Nobody is timing you. Nobody is marking you. Just escape.

How to play

  1. Download the evidence bag below, extract it, and open the folder in PyCharm (File > Open).
  2. Pick a lock. Write a program that works out the answer and prints it.
  3. Test your program on the small example first. If it is wrong on the example, it is wrong on the real thing.
  4. Type the answer on the keypad. Right answer: the lock opens and you get a key fragment letter.
  5. Open 3 of the 4 locks in a room to unlock the next door. Collect all 12 fragments to get the exit code.

Evidence bag

The data files for the Server Room and the Vault, plus an offline answer checker in case the internet fails.

escape-pack.zip
This is a zip file. You must extract it before you can use it.
  1. Find escape-pack.zip in your Downloads folder.
  2. Right-click it, choose Extract All…, then click Extract.
  3. A normal folder called escape-pack opens. Open that folder in PyCharm (File > Open).

Do not work from inside the zip, because PyCharm cannot read the data files from there. On a Mac, just double-click the zip.

Room 1

Staff Room

Everybody gets out of here. No files needed.

DOOR OPEN
B1

The coffee run

LOCKED

Mr Docherty needs caffeine to survive the afternoon. He buys 4 coffees at £2.35 each and 3 bacon rolls at £1.90 each, and pays with a £20 note.

Your task: Write a program that works out his change. Use variables for the prices and quantities.

Test your code on this first: 1 coffee and 1 roll paid for with a £5 note gives change of 0.75.

Answer format: Money to 2 decimal places, e.g. 3.25
Skills: variables, arithmetic, output

B2

Fire drill sums

LOCKED

The fire alarm goes off and the door lock only opens for the right number. The rule on the sign: add up every whole number from 1 to 300 that is a multiple of 6 or a multiple of 8.

Your task: Use a loop and MOD to build the total. (Numbers that are multiples of both are only counted once.)

Test your code on this first: From 1 to 20 the numbers are 6, 8, 12, 16, 18 → total 60.

Answer format: A whole number
Skills: fixed loop, MOD, selection with OR

B3

The late bell

LOCKED

The bell is stuck. It only rings on a number that is a multiple of 7 but not a multiple of 5. How many of the numbers from 1 to 500 make it ring?

Your task: Count them with a loop and an IF using AND.

Test your code on this first: From 1 to 40, the multiples of 7 are 7, 14, 21, 28, 35 — but 35 is also a multiple of 5, so the answer is 4.

Answer format: A whole number
Skills: loop, running count, selection with AND

B4

Vowel lock

LOCKED

The Computing corridor door is voice locked. It needs the number of vowels (a, e, i, o, u, capital or not) in this sentence:
Cover teachers are heroes who never get thanked enough

Your task: Store the sentence in a variable and count the vowels with a loop. Don't count by hand!

Test your code on this first: Hello World has 3 vowels.

Answer format: A whole number
Skills: string traversal, upper/lower case, running count

Room 2

Server Room

Data files, patterns and passwords.

DOOR LOCKED

The Server Room door is locked. Open 3 of the 4 locks in the Staff Room to get through.

S1

Attendance audit

LOCKED

Mr Docherty has found the class test scores in data/scores.txt (60 scores, one per line).

Your task: Read the file and find the highest score, the lowest score and the average (to 1 decimal place).

Test your code on this first: Scores 40, 90, 65, 20, 85 → 90-20-60.0

Answer format: highest-lowest-average, e.g. 90-20-60.0 (spaces don't matter)
Skills: reading a file, 1-D array, max, min, average

Evidence file: scores.txt (also in the evidence bag)

S2

Password patrol

LOCKED

The IT office has dumped 80 passwords into data/passwords.txt. A password is valid if it has at least 8 characters, at least one digit, at least one capital letter and no spaces.

Your task: Count how many of the 80 passwords are valid.

Test your code on this first: Tiger2024 is valid. tiger2024 (no capital), Tiger (too short, no digit) and Tiger 2024 (has a space) are not.

Answer format: A whole number
Skills: validation, functions, counting

Evidence file: passwords.txt (also in the evidence bag)

S3

Locker lottery

LOCKED

150 lockers and their 4-digit combinations are in data/lockers.csv (lines look like L001,4821).

Your task: Count how many lockers have a combination that contains the digit 7 at least once.

Test your code on this first: Combinations 1234, 7071, 5555, 1707 → 2

Answer format: A whole number
Skills: reading a file, splitting strings, counting occurrences

Evidence file: lockers.csv (also in the evidence bag)

S4

Tuck shop takings

LOCKED

The tuck shop has written its week into data/tuckshop.csv (item, price in pence, number sold). The first line is a heading.

Your task: Which item made the most money (price × number sold)?

Test your code on this first: crisps 60p × 10 = 600, juice 90p × 8 = 720, bar 45p × 15 = 675 → juice

Answer format: The item name in lower case, e.g. juice
Skills: parallel arrays, find the maximum

Evidence file: tuckshop.csv (also in the evidence bag)

Room 3

The Vault

Real problem-solving. Bring your brain.

DOOR LOCKED

The Vault door is locked. Open 3 of the 4 locks in the Server Room to get through.

G1

The speech

LOCKED

Mr Docherty wrote a long, rambling speech, saved in data/speech.txt. Somebody has to find its most overused word.

Your task: Find the most common word. Ignore capital letters and punctuation, and ignore any word of 3 letters or fewer.

Test your code on this first: The lion saw the other lion. Lions! → lion-2 (the and saw are too short to count, and lions is a different word from lion).

Answer format: word-count, e.g. lion-2
Skills: string handling, dictionaries or parallel arrays, algorithm design

Evidence file: speech.txt (also in the evidence bag)

G2

Secret message

LOCKED

An encrypted message is in data/secret.txt. It was locked by shifting every letter forward by 7 places (A→H, B→I … and it wraps round, so T→A).

Your task: Decrypt it. The passphrase is hidden in the message.

Test your code on this first: OLSSV decrypts to HELLO

Answer format: The passphrase in lower case
Skills: ASCII codes, modular arithmetic, string building

Evidence file: secret.txt (also in the evidence bag)

G3

Prime suspects

LOCKED

The final door only opens for prime numbers.

Your task: How many prime numbers are there below 5000, and what is the largest one?

Test your code on this first: Below 20 the primes are 2, 3, 5, 7, 11, 13, 17, 19 → 8-19

Answer format: count-largest, e.g. 8-19
Skills: nested loops, efficient algorithm design

G4

Minefield

LOCKED

data/board.txt is a 16 × 16 minesweeper board: * is a mine, . is a safe square.

Your task: Each safe square shows how many of its (up to 8) neighbours are mines. Work out the number for every safe square and give the total of all of them.

Test your code on this first:
*..
...
..*
gives 6 (the middle square shows 2).

Answer format: A whole number
Skills: 2-D lists, nested loops, boundary checking

Evidence file: board.txt (also in the evidence bag)

You escaped!

All 12 locks open. Say the exit code to the person at the door:

HAPPY HOLIDAY
Name:Date: