A classic GCSE experiment to model radioactive decay and half live involves the random shaking of cubes and removing the ones which land face up.
The full code for this project can be found here
The code can be run on a Raspberry Pi or on an online Python3 shell. I have included instructions in using gnuplot to draw a graph of the results.
Gnuplot can be installed using:
sudo apt-get install gnuplot-x1
You can change the number of starting cubes by editing the line
max_count = 100
The whole experiment is carried out before displaying any results!
The results are saved to a file called