From 5d61e04a61cbe255bb305d97a1d2010cd7ba88d1 Mon Sep 17 00:00:00 2001 From: Bertrand <bneron@pasteur.fr> Date: Mon, 11 Mar 2019 11:53:09 +0100 Subject: [PATCH] :art: use python3 syntax add othre version working with python2 --- source/_static/code/vol_of_sphere.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/_static/code/vol_of_sphere.py b/source/_static/code/vol_of_sphere.py index 7288495..cf43171 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 -- GitLab