From b87ce2eca26c796076259b5f811339b0152f7762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Egehan=20Hatipo=C4=9Flu?= Date: Sat, 31 Oct 2026 00:59:47 +0300 Subject: [PATCH 1/3] Add custom power and equation functions with counter --- Week04/functions_egehan_hatipoglu.py | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 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..56806f00 --- /dev/null +++ b/Week04/functions_egehan_hatipoglu.py @@ -0,0 +1,30 @@ +import inspect + +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: + + + + return (x**a + y**b) / c + + +counter = 0 +callers = {} + + +def fn_w_counter() -> tuple: + global counter + + counter += 1 + + caller = inspect.currentframe().f_back.f_globals["__name__"] + + if caller in callers: + callers[caller] += 1 + else: + callers[caller] = 1 + + return counter, callers.copy() From 364795185df42e1f865a4ef240ad0e17b72ee955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Egehan=20Hatipo=C4=9Flu?= Date: Sat, 31 Oct 2026 01:09:19 +0300 Subject: [PATCH 2/3] Enhance docstring for custom_equation Updated docstring for custom_equation function. --- Week04/functions_egehan_hatipoglu.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Week04/functions_egehan_hatipoglu.py b/Week04/functions_egehan_hatipoglu.py index 56806f00..638e0fad 100644 --- a/Week04/functions_egehan_hatipoglu.py +++ b/Week04/functions_egehan_hatipoglu.py @@ -5,9 +5,16 @@ def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float: - - - + """ + Calculate a mathematical equation. + + :param x: First integer + :param y: Second integer + :param a: First exponent + :param b: Second exponent + :param c: Divisor + :return: Equation result + """ return (x**a + y**b) / c From d1c126a777de25622f8036bd0dcecdadf95d2d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Egehan=20Hatipo=C4=9Flu?= Date: Sat, 31 Oct 2026 01:11:24 +0300 Subject: [PATCH 3/3] Update functions_egehan_hatipoglu.py --- Week04/functions_egehan_hatipoglu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Week04/functions_egehan_hatipoglu.py b/Week04/functions_egehan_hatipoglu.py index 638e0fad..8c71551a 100644 --- a/Week04/functions_egehan_hatipoglu.py +++ b/Week04/functions_egehan_hatipoglu.py @@ -22,7 +22,8 @@ def custom_equation(x: int = 0, y: int = 0, /, callers = {} -def fn_w_counter() -> tuple: +def fn_w_counter() -> tuple[int, dict[str, int]]: + global counter counter += 1