Skip to content

Commit

Permalink
Update sphere.py with new feature
Browse files Browse the repository at this point in the history
added surface area function (using formula 4pi * r^2

Co-Authored-By: EyerusalemAbebaw <[email protected]>
  • Loading branch information
ashleyhumphries and EyerusalemAbebaw committed Aug 5, 2024
1 parent 072ecb5 commit c7428aa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/geometry/sphere.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from math import pi


def calculate_surface_area(r):
"""
Calculate the surface area of a sphere.
This uses the standard mathematical calculation:
$4\pi r ^2$
Parameters
----------
r : float, the radius
Returns
-------
float : the surface area of the sphere
"""
surface_area = 4 * pi * r **2
return surface_area

1 comment on commit c7428aa

@EyerusalemAbebaw
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#39

Please sign in to comment.