0 out of 464 challenges solved
Write a Python function `volume_of_sphere(radius)` that calculates and returns the volume of a sphere given its radius. The formula for the volume of a sphere is: \[ V = \frac{4}{3} \pi r^3 \] Where: - \( V \) is the volume, - \( r \) is the radius of the sphere, - \( \pi \) is a mathematical constant approximately equal to 3.14159. #### Example Usage: ```python [main.nopy] print(volume_of_sphere(10)) # Expected output: 4188.790204786391 print(volume_of_sphere(25)) # Expected output: 65449.84694978735 print(volume_of_sphere(20)) # Expected output: 33510.32163829113 ``` #### Constraints: - The radius will always be a positive number.
import math def volume_of_sphere(radius): """ Calculate the volume of a sphere given its radius. Args: radius (float): The radius of the sphere. Returns: float: The volume of the sphere. """ # Implement the formula for the volume of a sphere pass