From 28a45bbb3d63fa917597131f0bbf523b8648c8f5 Mon Sep 17 00:00:00 2001 From: fdai7783 Date: Fri, 19 Jan 2024 02:04:24 +0100 Subject: [PATCH] Added logaritim dualis functionality with one position arugment and test for it --- 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 b4606f2..dc181e1 100644 --- a/src/main/py/logarithmic_and_expo_and_root_calculations.py +++ b/src/main/py/logarithmic_and_expo_and_root_calculations.py @@ -11,3 +11,7 @@ def potentiate(first_number, second_number): def logarithmize(first_number, second_number): return math.log(first_number, second_number) + + +def logarithmize_dualis(first_number): + return math.log2(first_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 d326a54..08cd50d 100644 --- a/src/test/py/logarithmic_ann_expo_and_root_calculations.py +++ b/src/test/py/logarithmic_ann_expo_and_root_calculations.py @@ -18,6 +18,9 @@ class primitive_calculations(unittest.TestCase): def test_8_log_3_equals_2(self): self.assertEqual(logarithmize(4, 2), 2) + def test_4_ld_equals_2(self): + self.assertEqual(logarithmize_dualis(4), 2) + if __name__ == "__main__": unittest.main()