Your question is Tape Length Calculation. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Imperial College London facilities may need to estimate how much tape remains on a roll. Given the roll's outer radius, empty-core radius, tape width, and tape thickness, calculate the tape length.
Treat the wound tape as the annular region between the core and the outer surface. Use volume conservation: the volume of the wound tape equals the volume of a rectangular strip with length L, width w, and thickness t.
Implement tape_length(outer_radius, core_radius, width, thickness). All dimensions are positive real numbers in the same unit. Return the tape length in that unit as a floating-point number. The tape is wound tightly, with no gaps or compression.
The roll volume is:
π * (outer_radius² - core_radius²) * width
The tape volume is:
length * width * thickness
Therefore, calculate the length without iterating through individual layers. The supplied width must be accepted even though it cancels algebraically.
def tape_length(outer_radius, core_radius, width, thickness):