From 94da305be07917176c0379746e45e827fabacde2 Mon Sep 17 00:00:00 2001 From: fdai7764 Date: Sat, 27 Jan 2024 15:36:03 +0100 Subject: [PATCH] added recognition of zero exponent to instantly return 1 to reduce room for errors --- src/main/py/calculations_with_roots.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/py/calculations_with_roots.py b/src/main/py/calculations_with_roots.py index 3b5f9ea..02cf33b 100644 --- a/src/main/py/calculations_with_roots.py +++ b/src/main/py/calculations_with_roots.py @@ -8,4 +8,6 @@ def multiplyRoots(first_number, second_number): def sqrt_power(base, exponent): if base < 0: return -1 + if exponent == 0: + return 1 return potentiate(sqrt(base), exponent) \ No newline at end of file