diff --git a/source/_static/code/vol_of_sphere.py b/source/_static/code/vol_of_sphere.py index 72884956851f2ce1d5bee95928c00646380d560d..cf43171f6e27eafdcfd355279aabb519630995dd 100644 --- a/source/_static/code/vol_of_sphere.py +++ b/source/_static/code/vol_of_sphere.py @@ -3,7 +3,18 @@ import math def vol_of_sphere(radius): """ compute the volume of sphere of a given radius + work only in python3 """ - vol = float(4)/float(3) * float(math.pi) * pow(radius, 3) + vol = 4 / 3 * math.pi * pow(radius, 3) + return vol + + +def vol_of_sphere_python2(radius): + """ + compute the volume of sphere of a given radius + work with python2 and 3 + """ + + vol = float(4) / float(3) * float(math.pi) * pow(radius, 3) return vol