Skip to content

Commit 01e6761

Browse files
authored
Update functions_mert_durgun.py
1 parent 2b0f40c commit 01e6761

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

Week04/functions_mert_durgun.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
custom_power = lambda x=0, e=1: x ** e
1+
custom_power = lambda x=0, /, e=1 : x**e
22

3-
def custom_equation(x: int = 0, y: int = 0, a: int = 1, b: int = 1, *, c: int = 1) -> float:
4-
return (a * x + b * y) / c
3+
def custom_equation(x: int = 0, y: int = 0,/, a: int = 1, b: int = 1, *, c: int=1) -> float:
4+
return (x**a + y**b) / c
55

6-
counter = 0
7-
def fn_w_counter() -> (int, dict[str, int]):
8-
counter += 1
9-
return counter, {"functions_1": counter}
6+
7+
def fn_w_counter() -> (int, dict[str,int]):
8+
9+
if not hasattr(fn_w_counter, "counter"):
10+
fn_w_counter.counter = 0
11+
12+
fn_w_counter.counter += 1
13+
module_name = __name__
14+
call_counter_dict = {module_name: fn_w_counter.counter}
15+
16+
return fn_w_counter.counter, call_counter_dict

0 commit comments

Comments
 (0)