From f0c107d3a2b131bd509977f949239b352c7c7f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Egehan=20Hatipo=C4=9Flu?= Date: Sun, 1 Nov 2026 18:36:45 +0300 Subject: [PATCH 1/2] Implement custom power and equation functions Added custom power and equation functions with a counter. --- Week04/functions_egehan_hatipoglu.py | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Week04/functions_egehan_hatipoglu.py diff --git a/Week04/functions_egehan_hatipoglu.py b/Week04/functions_egehan_hatipoglu.py new file mode 100644 index 00000000..002176a0 --- /dev/null +++ b/Week04/functions_egehan_hatipoglu.py @@ -0,0 +1,33 @@ +custom_power = lambda x=0, /, e=1: x**e + + +def custom_equation( + x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1 +) -> float: + + """Calculates the custom equation. + + :param x: first base + :param c: divisor + :type c: int + :return: the result of (x**a + y**b) / c + :rtype: float + """ + + return float((x**a + y**b) / c) + + +def fn_w_counter() -> tuple[int, dict[str, int]]: + if not hasattr(fn_w_counter, "total_count"): + fn_w_counter.total_count = 0 + fn_w_counter.call_records = {} + + caller = __name__ + fn_w_counter.total_count += 1 + + if caller not in fn_w_counter.call_records: + fn_w_counter.call_records[caller] = 1 + else: + fn_w_counter.call_records[caller] += 1 + + return fn_w_counter.total_count, fn_w_counter.call_records From 0d37e228f0d30a929e8b19182cb33bbf861b236f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Egehan=20Hatipo=C4=9Flu?= Date: Sun, 1 Nov 2026 18:38:48 +0300 Subject: [PATCH 2/2] Update functions_egehan_hatipoglu.py --- Week04/functions_egehan_hatipoglu.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Week04/functions_egehan_hatipoglu.py b/Week04/functions_egehan_hatipoglu.py index 002176a0..16b2f0a6 100644 --- a/Week04/functions_egehan_hatipoglu.py +++ b/Week04/functions_egehan_hatipoglu.py @@ -1,19 +1,19 @@ -custom_power = lambda x=0, /, e=1: x**e - - -def custom_equation( - x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1 -) -> float: - +def custom_equation(x: int, y: int, a: int, b: int, c: int) -> float: """Calculates the custom equation. :param x: first base + :type x: int + :param y: second base + :type y: int + :param a: first exponent + :type a: int + :param b: second exponent + :type b: int :param c: divisor :type c: int :return: the result of (x**a + y**b) / c :rtype: float """ - return float((x**a + y**b) / c)