From 14d63c323b17f2faa1483a03a893ae8dc3a47025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Senem=20=C3=9Crkmez?= <148161293+senemur@users.noreply.github.com> Date: Tue, 12 Mar 2024 18:03:24 +0300 Subject: [PATCH] Create functions_senem_urkmez.py --- Week03/functions_senem_urkmez.py | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Week03/functions_senem_urkmez.py diff --git a/Week03/functions_senem_urkmez.py b/Week03/functions_senem_urkmez.py new file mode 100644 index 00000000..90190080 --- /dev/null +++ b/Week03/functions_senem_urkmez.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: + """ + This function returns: + The power of x to the a and + the power of y to the b are + added and divided by c. + + :param x : First Number + :param y : Second Number + :param a : Third Number + :param b : Fourth Number + :param c : Fifth Number + :return: result as a floating-point number. + """ + return float((x**a + y**b) / c) + + +def fn_w_counter(): + if not hasattr(fn_w_counter, "calls"): + fn_w_counter.calls = 0 + fn_w_counter.caller_dict = {} + caller_name = __name__ + fn_w_counter.calls += 1 + + if caller_name in fn_w_counter.caller_dict: + fn_w_counter.caller_dict[caller_name] += 1 + else: + fn_w_counter.caller_dict[caller_name] = 1 + + return fn_w_counter.calls, fn_w_counter.caller_dict