Gauge Diameter
Source: Dec 2025, Task 1 (DTU 02002/02003). Study solution — not an official answer key.
Problem
An n-gauge ball has volume V/n with V = 40 cm³, so (π/6) d³ = V/n, i.e. d = (6V / (n π))1/3.
Write gauge_diameter(n) returning the diameter in cm.
Example
>>> gauge_diameter(12)
1.8533610896304256
Approach
Use math.pi and raise to the power 1/3 (or **(1/3)).
Solution
Show solution Hide solution
Solution
import math
def gauge_diameter(n):
V = 40
return (6 * V / (n * math.pi)) ** (1 / 3)