The doors are locked and only code will open them. Solve puzzles in Python, check your answers with check.py, collect stars.
check.py, type the puzzle ID (e.g. A1) and your answer. Every puzzle has a small example you can test your code on first. After 3 wrong answers you get a hint.Warm-up. Open 4 of 5 to unlock the next room.
The fire alarm goes off and the door only opens for the right number. The rule on the sign: add up every whole number from 1 to 1000 that is a multiple of 7 or a multiple of 13, but is not a multiple of 5.
Your task: Use a loop and MOD to build the total. Be careful with the brackets around your OR.
148.The staff room door has a mirror lock. It wants the number of palindromes (words that read the same forwards and backwards, ignoring capitals) in this sentence. Single letters and two-letter words do not count: a palindrome here has 3 or more letters.Anna and Bob saw a level racecar near the radar while Hannah noted that Otto painted a kayak and a madam asked about the refer button on the noon timetable but Eve ignored the stats
Your task: Store the sentence in a variable, split it into words and test each one. Write the palindrome test as a function that takes a word and returns True or False.
Anna saw a racecar has 2 palindromes (Anna and racecar; saw is not one and a is too short).The bell system has crashed. The times of the day’s bells are in data/bells.txt (24-hour times like 09:40, one per line, in order).
Your task: Find the longest gap between two bells next to each other in the file. Give the gap in minutes and the time of the bell where that gap starts.
70-10:05The dial only turns for numbers whose digits add up to exactly 20. For example 389 works (3 + 8 + 9 = 20) but 390 does not.
Your task: Write a function digit_sum(number) that returns the sum of the digits of a number. Then use it to look at every whole number from 1 to 5000. Give how many numbers have a digit sum of 20 and the largest one.
digit_sum(1234) gives 10. For a digit sum of 10 between 1 and 100 you get 19, 28, 37, 46, 55, 64, 73, 82, 91 → 9-91The staff room tea urn has been logging its temperature in data/urn.txt (48 readings in °C, one per line, each with one decimal place). Somebody needs to know how bad it got.
Your task: Find the highest reading, the lowest reading and how many readings are above the average (mean) of all 48.
90.5-65.0-2Data files, records and sub-programs. Open 3 of 5 to unlock the Vault.
HR has dumped the staff list into data/staff.csv (90 staff). The first line is a heading. Each line is staff_id,department,years_service,salary.
Your task: Store each member of staff as a record in a 1-D array of records. Only staff with 5 or more years’ service count. Which department has the highest total salary for those staff, and what is that total?
maths-50000 (maths 30000 + 20000 = 50000; art only counts S4 = 45000)The IT office has dumped 132 passwords into data/passwords.txt (one per line, a few contain spaces). A password is valid only if it follows every rule:
! # $ % & * (a dash, full stop or underscore does not count)password, in any mix of capitals and lower caseYour task: Count how many passwords are valid. Write one function that checks a single password and returns True or False, then call it for each line.
Harbour#2024 is valid. Not valid: harbour#2024 (no capital), Harbour2024x (no symbol), Harbour #2024 (space), MyPassWord#12 (contains “password”), Tiger#24 (too short).Somebody has been guessing passwords on the school server. The log is data/access.log: a heading line, then lines like 07:15:02,10.0.4.23,FAIL (time, IP address, result). The result is OK or FAIL, but the logging software is sloppy: a failure can be written FAIL, Fail or fail.
Your task: Find the IP address with the most failed logins and say how many it had.
10.0.1.5-2150 lockers and their 4-digit combinations are in data/lockers.csv (lines look like L001,0517). Careful: some combinations start with a 0. A combination is rising if every digit is bigger than the digit before it, so 0358 and 1469 are rising but 1233 and 5731 are not.
Your task: Count the lockers with a rising combination, and give the locker number of the last one in the file. Write a function that takes a combination and returns True or False.
2-l003The tuck shop has written its week into data/tuckshop.csv: a heading line, then item,category,price_pence,sold (an item that did not sell has 0 sold). Revenue for an item is price × number sold.
Your task: Which category made the most money in total, and how many pence was that? Write a function that takes the array of records and a category name and returns that category’s total revenue, then call it for each category.
snacks-1275 (drinks only reach 1020)The stretch. Open all 5 for the final exit code.
An encrypted message is in data/secret.txt. Every letter was shifted forward through the alphabet by an amount taken from a repeating keyword: VAULT. The first letter of the message moves by V (21 places, since A = 0), the second by A (0), the third by U (20), then L (11), T (19), and then the keyword starts again. Spaces and full stops are left alone and do not use up a keyword letter.
Your task: Decrypt the message. The passphrase is hidden inside it.
BAD, IEOMO decrypts to HELLOA sensor on the vault wall records temperature changes as 8-bit two’s complement binary numbers. The tape is in data/sensor.txt (64 readings, one per line, such as 11111100). The leftmost bit is the sign bit.
Your task: Convert every reading to the signed denary number it stores. Give the total of all the readings and how many are negative. (Do not just use int(reading, 2) on its own: that treats the sign bit as an ordinary bit.)
00001010 = 10, 11111100 = −4, 10000000 = −128, 01111111 = 127 → 5-2The vault’s inner door only opens for twin primes: two prime numbers that differ by exactly 2, like 11 and 13.
Your task: Count the pairs of twin primes where both numbers are below 10000, and give the smaller number of the largest pair.
4-17 (29 and 31 do not count because 31 is not below 30)data/board.txt is a 20 × 20 minesweeper board: * is a mine, . is a safe square.
Your task: Every safe square shows how many of its (up to 8) neighbours are mines. Give the total of all the numbers on safe squares and the largest single number on the board.
*.. ... ..*shows 1,0 / 1,2,1 / 0,1 so the total is 6 and the largest is 2 →
6-2The vault is full of old pipework. data/vault.txt is a 14 × 14 map: . is open pipe and # is a blockage. Water starts in the top-left corner and must reach the bottom-right corner, moving only right or down one square at a time, never through a #.
Your task: How many different routes can the water take?
..# ... #..has
4 routes.