This Python script is used to generate a 3D shape of a Sierpinski carpet, and the fractal Dimension was calculated (1, 2,3): It contains a line-by-line breakdown of how the code works. Firstly, it generates a 3D fractal, counts occupied boxes at different scales, and computes the fractal dimension.
an example of the code ran in ethe xample can be found in my repo at: Here