Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hub-courses
python_one_week_4_biologists_solutions
Commits
5d61e04a
Verified
Commit
5d61e04a
authored
Mar 11, 2019
by
Bertrand NÉRON
Browse files
🎨
use python3 syntax
add othre version working with python2
parent
119061f9
Pipeline
#10134
passed with stages
in 22 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
source/_static/code/vol_of_sphere.py
View file @
5d61e04a
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment