From 86b4b1e3ce65236990fb19ea4c4b09ed044b47ad Mon Sep 17 00:00:00 2001 From: fdai7783 Date: Fri, 19 Jan 2024 01:59:41 +0100 Subject: [PATCH] Added logarithmize functionality and test --- src/main/py/logarithmic_and_expo_and_root_calculations.py | 4 ++++ src/test/py/logarithmic_ann_expo_and_root_calculations.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/main/py/logarithmic_and_expo_and_root_calculations.py b/src/main/py/logarithmic_and_expo_and_root_calculations.py index b9df0fa..b4606f2 100644 --- a/src/main/py/logarithmic_and_expo_and_root_calculations.py +++ b/src/main/py/logarithmic_and_expo_and_root_calculations.py @@ -7,3 +7,7 @@ def sqrt(root_of): def potentiate(first_number, second_number): return math.pow(first_number, second_number) + + +def logarithmize(first_number, second_number): + return math.log(first_number, second_number) diff --git a/src/test/py/logarithmic_ann_expo_and_root_calculations.py b/src/test/py/logarithmic_ann_expo_and_root_calculations.py index 2778afe..d326a54 100644 --- a/src/test/py/logarithmic_ann_expo_and_root_calculations.py +++ b/src/test/py/logarithmic_ann_expo_and_root_calculations.py @@ -15,6 +15,9 @@ class primitive_calculations(unittest.TestCase): def test_2_potentiate_3_equals_8(self): self.assertEqual(potentiate(2, 3), 8) + def test_8_log_3_equals_2(self): + self.assertEqual(logarithmize(4, 2), 2) + if __name__ == "__main__": unittest.main()