Skip to content

Commit 0e6a9d2

Browse files
authored
Update functions_mert_durgun.py
1 parent 01e6761 commit 0e6a9d2

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Week04/functions_mert_durgun.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
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:
3+
def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float:
44
return (x**a + y**b) / c
55

66

7-
def fn_w_counter() -> (int, dict[str,int]):
87

8+
9+
def fn_w_counter() -> (int, dict[str, int]):
910
if not hasattr(fn_w_counter, "counter"):
1011
fn_w_counter.counter = 0
11-
12+
fn_w_counter.dict = {}
13+
caller_name = __name__
1214
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
15+
if caller_name in fn_w_counter.dict:
16+
fn_w_counter.dict[caller_name] += 1
17+
else:
18+
fn_w_counter.dict[caller_name] = 1
19+
return fn_w_counter.counter, fn_w_counter.dict

0 commit comments

Comments
 (0)