From c85f08bae33c033e9ad956a069fe1e391dbb3c23 Mon Sep 17 00:00:00 2001 From: Sounabha Sarkar Date: Mon, 12 Oct 2026 00:49:47 +0530 Subject: [PATCH 1/4] feat: add volume of cylinder algorithm --- maths/volume_of_cylinder.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 maths/volume_of_cylinder.py diff --git a/maths/volume_of_cylinder.py b/maths/volume_of_cylinder.py new file mode 100644 index 000000000000..861ece5f14e9 --- /dev/null +++ b/maths/volume_of_cylinder.py @@ -0,0 +1,24 @@ +import math + +def volume_of_cylinder(radius: float, height: float) -> float: + """ + Calculate the volume of a cylinder. + Formula: pi * radius^2 * height + + Examples: + >>> volume_of_cylinder(3.0, 5.0) + 141.37 + >>> volume_of_cylinder(2.5, 4.0) + 78.54 + >>> volume_of_cylinder(0.0, 5.0) + 0.0 + """ + if radius < 0 or height < 0: + raise ValueError("Radius and height cannot be negative") + + volume = math.pi * (radius ** 2) * height + return round(volume, 2) + +if __name__ == "__main__": + import doctest + doctest.testmod() \ No newline at end of file From 793b72ecac0c07ef8a6bf71d4bf44564e6d0c28c Mon Sep 17 00:00:00 2001 From: Sounabha Sarkar Date: Mon, 12 Oct 2026 01:07:05 +0530 Subject: [PATCH 2/4] feat: add volume of cylinder algorithm --- maths/volume_of_cylinder.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/maths/volume_of_cylinder.py b/maths/volume_of_cylinder.py index 861ece5f14e9..e16a702b5f81 100644 --- a/maths/volume_of_cylinder.py +++ b/maths/volume_of_cylinder.py @@ -1,10 +1,8 @@ import math - def volume_of_cylinder(radius: float, height: float) -> float: """ Calculate the volume of a cylinder. Formula: pi * radius^2 * height - Examples: >>> volume_of_cylinder(3.0, 5.0) 141.37 @@ -15,10 +13,8 @@ def volume_of_cylinder(radius: float, height: float) -> float: """ if radius < 0 or height < 0: raise ValueError("Radius and height cannot be negative") - volume = math.pi * (radius ** 2) * height return round(volume, 2) - if __name__ == "__main__": import doctest doctest.testmod() \ No newline at end of file From 22134278b8ee6e62ea0ada8c654874e51e3e4313 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 11 Oct 2026 19:43:00 +0000 Subject: [PATCH 3/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- maths/volume_of_cylinder.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/maths/volume_of_cylinder.py b/maths/volume_of_cylinder.py index e16a702b5f81..499c0c9ebe69 100644 --- a/maths/volume_of_cylinder.py +++ b/maths/volume_of_cylinder.py @@ -1,4 +1,6 @@ import math + + def volume_of_cylinder(radius: float, height: float) -> float: """ Calculate the volume of a cylinder. @@ -13,8 +15,11 @@ def volume_of_cylinder(radius: float, height: float) -> float: """ if radius < 0 or height < 0: raise ValueError("Radius and height cannot be negative") - volume = math.pi * (radius ** 2) * height + volume = math.pi * (radius**2) * height return round(volume, 2) + + if __name__ == "__main__": import doctest - doctest.testmod() \ No newline at end of file + + doctest.testmod() From 43c56e4d684cdb060d0ce513665efd26085d15b0 Mon Sep 17 00:00:00 2001 From: Sounabha Sarkar Date: Mon, 12 Oct 2026 07:30:46 +0530 Subject: [PATCH 4/4] style(maths): alias datetime to dt in zellers_congruence --- maths/zellers_congruence.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maths/zellers_congruence.py b/maths/zellers_congruence.py index b958ed3b8659..12ebe6c57f01 100644 --- a/maths/zellers_congruence.py +++ b/maths/zellers_congruence.py @@ -1,5 +1,5 @@ import argparse -import datetime +import datetime as dt def zeller(date_input: str) -> str: @@ -120,7 +120,7 @@ def zeller(date_input: str) -> str: ) # Get datetime obj for validation - dt_ck = datetime.date(int(y), int(m), int(d)) + dt_ck = dt.date(int(y), int(m), int(d)) # Start math if m <= 2: