On the first day of school, the principal of Locker High school decides to conduct an experiment. The school has exactly 1,000 students and 1,000 lockers all lined up alongside the main corridor of the school.

- The principal asks the first student to walk down the main corridor of the school to close all the lockers.
- The principal then asks the second student to walk down the main corridor and open every other locker.
- The principal then asks the third student to walk down the main corridor and either open every third locker if it is closed, or close it if it is open.
- The fourth student will then repeat the same process for every fourth locker.
- And so on, till the last of the 1,000 students repeats this process for every 1,000th locker, so in fact, just opening the 1,000th locker if it is closed, or closing it if it is already open.
At the end of this experiment the principal decides to count the number of lockers which are closed.
It is possible to solve this puzzle using your mathematical skills, however in this challenge, your task is to implement a computer program (using Python) to simulate this experiment and at the end, count and output the total number of lockers which are closed.
We have started the code and completed three sections of the code as follows:
Step 1:
We start by initialising an array/list of 1,000 values representing the 1,000 lockers:
- 0 will represent an open locker,
- 1 will represent a closed locker.
lockers = [0] * 1000
Step 2:
for i in range(0,1000): lockers[i] = 1
A similar approach will need to be implemented to reproduce the actions of the remaining 999 students! This will be your task!
Step 3:
total = 0
for i in range(0,1000):
total = total + lockers[i]
print("Total number of lockers closed: " + str(total))
Python Code
You will need to complete the following code to solve this challenge:
The Principal’s padlock
The solution to the above challenge is the combination of the principal’s padlock. Use the output of your code to see if you can unlock this padlock!

Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area
























A barcode is a visual representation of data that can easily be read by an optical barcode scanner/reader. Barcodes are used to facilitate and speed up the identification of different types of products. Using a barcode reader speed up the input/data entry process and and is a more reliable method generating less data entry errors than when a product code is entered manually.




Source: NASA/JPL-Caltech



On February 18, 2020, NASA’s rover called “Perseverance” successfully landed on Mars. The mission of this high-tech 6-wheel rover is to explore the surrounding areas, analyse the Martian soil on different locations, take high definition pictures as well as audio recordings. The ultimate hope for NASA is that this rover may find evidence that there was once a form of life on planet Mars. You can read more about this rover on the 







