From a45f862f2a8f7dc068c53b2161a110fc379172c8 Mon Sep 17 00:00:00 2001 From: izzalDev <92254049+izzalDev@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:25:23 +0700 Subject: [PATCH] Feat: Menambah fitur untuk menghitung volume bola (#92) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate (#66) updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.1 → v0.2.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.1...v0.2.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#69) updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.2...v0.3.2) - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (#77) updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) - [github.com/MarcoGorelli/auto-walrus: v0.2.2 → 0.3.4](https://github.com/MarcoGorelli/auto-walrus/compare/v0.2.2...0.3.4) - [github.com/astral-sh/ruff-pre-commit: v0.3.2 → v0.4.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.2...v0.4.3) - [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.10.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.9.0...v1.10.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(docs): menambahkan komentar kode (#90) Signed-off-by: slowy07 * feat: menambahkan fungsi untuk menghitung volume bola * Update OpenSeries/matematika.py Co-authored-by: arfy slowy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: slowy07 Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: arfy slowy Co-authored-by: arfy slowy --- OpenSeries/matematika.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/OpenSeries/matematika.py b/OpenSeries/matematika.py index c555c58..180cb14 100644 --- a/OpenSeries/matematika.py +++ b/OpenSeries/matematika.py @@ -590,6 +590,20 @@ def turunan( return (f(x + h) - f(x)) / h +def volume_bola(r: Union[int, float]) -> Union[float, error.ErrorTipeData]: + """ + Menghitung volume dari sebuah bola + Args: + r (Union[int, float]): input radius + Return: + float : volume dari bola + """ + if not isinstance(r, (float, int)): + return error.ErrorTipeData(["float", "int"]) + else: + return (4 / 3) * constant.PI * r**3 + + def mean_absolut_deviasi( nilai: list[int], ) -> Union[error.Error, error.ErrorTipeData, float]: