Skip to content

Commit 793b72e

Browse files
committed
feat: add volume of cylinder algorithm
1 parent c85f08b commit 793b72e

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

‎maths/volume_of_cylinder.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import math
2-
32
def volume_of_cylinder(radius: float, height: float) -> float:
43
"""
54
Calculate the volume of a cylinder.
65
Formula: pi * radius^2 * height
7-
86
Examples:
97
>>> volume_of_cylinder(3.0, 5.0)
108
141.37
@@ -15,10 +13,8 @@ def volume_of_cylinder(radius: float, height: float) -> float:
1513
"""
1614
if radius < 0 or height < 0:
1715
raise ValueError("Radius and height cannot be negative")
18-
1916
volume = math.pi * (radius ** 2) * height
2017
return round(volume, 2)
21-
2218
if __name__ == "__main__":
2319
import doctest
2420
doctest.testmod()

0 commit comments

Comments
 (0)