From 5bea69e467e8e856c082f958f33e3a7345c9c9c4 Mon Sep 17 00:00:00 2001 From: Zeynep Sude BAYRAM <144821836+Zeyneepsudee@users.noreply.github.com> Date: Tue, 27 Oct 2026 08:59:47 +0300 Subject: [PATCH] Add custom functions for power and equation calculations Zeynep Sude --- Week04/functions_zeynepsude_bayram.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Week04/functions_zeynepsude_bayram.py diff --git a/Week04/functions_zeynepsude_bayram.py b/Week04/functions_zeynepsude_bayram.py new file mode 100644 index 00000000..674dde48 --- /dev/null +++ b/Week04/functions_zeynepsude_bayram.py @@ -0,0 +1,25 @@ +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: + """ + Computes (x**a + y**b) / c. + + :param x: First base + :param y: Second base + :param a: Exponent of x + :param b: Exponent of y + :param c: Divisor + :return: (x**a + y**b) / c + """ + if not all(isinstance(i, int) for i in (x, y, a, b, c)): + raise TypeError("All parameters must be integers") + return (x ** a + y ** b) / c + + +counter = {} + + +def fn_w_counter() -> (int, dict[str, int]): + counter[__name__] = counter.get(__name__, 0) + 1 + return sum(counter.values()), counter