diff --git a/Week04/functions_batuhan_ayyildiz.py b/Week04/functions_batuhan_ayyildiz.py new file mode 100644 index 00000000..caf59399 --- /dev/null +++ b/Week04/functions_batuhan_ayyildiz.py @@ -0,0 +1,20 @@ + +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 + +def fn_w_counter() -> (int, dict[str, int]): + if not hasattr(fn_w_counter, "count"): + setattr(fn_w_counter, "count", 0) + setattr(fn_w_counter, "caller_dict", {}) + + fn_w_counter.count += 1 + caller = __name__ + + if caller not in fn_w_counter.caller_dict: + fn_w_counter.caller_dict[caller] = 0 + + fn_w_counter.caller_dict[caller] += 1 + + return int(fn_w_counter.count), dict(fn_w_counter.caller_dict)