Skip to content

Commit 25c49c4

Browse files
authored
Update functions_aysegul_ezber.py
1 parent 7c4f3a9 commit 25c49c4

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

Week04/functions_aysegul_ezber.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
custom_power_calc = lambda base=0, /, exponent=1: base ** exponent
21

3-
def custom_calculation(x:int = 0, y:int = 0, /, a:int = 1, b:int = 1, *, c:int = 1) -> float:
2+
custom_power = lambda x=0,/, e=1: x**e
3+
4+
5+
def custom_equation(x:int = 0,y:int=0,/,a:int = 1,b:int=1,*,c:int=1) -> float:
46
"""
5-
:param x: The positional-only integer base parameter for the equation, default is 0
6-
:param y: The positional-only integer base parameter for the equation, default is 0
7-
:param a: The positional-or-keyword integer exponent parameter for the equation, default is 1
8-
:param b: The positional-or-keyword integer exponent parameter for the equation, default is 1
9-
:param c: The keyword-only integer divisor parameter for the equation, default is 1
10-
:return: The result of the calculation as a float, where the equation is (x**a + y**b) / c
7+
:param x: The positional-only integer base parameter for the equation , default is 0
8+
:param y: The positional-only integer base parameter for the equation , default is 0
9+
:param a: The positional-or-keyword integer exponent parameter for the equation , default is 1
10+
:param b: The positional-or-keyword integer exponent parameter for the equation , default is 1
11+
:param c: The keyword-only integer divisor parameter for the equation , default is 1
12+
:return: The result of the calculation as a float and the equation is (x**a + y**b)/c
1113
:rtype: float
1214
"""
13-
return (x ** a + y ** b) / c
15+
return (x**a + y**b)/c
1416

1517
def fn_w_counter() -> (int, dict[str, int]):
16-
if not hasattr(fn_w_counter, '_total_calls'):
17-
fn_w_counter._total_calls = 0
18-
fn_w_counter._call_registry = {}
19-
20-
current_caller = __name__
21-
fn_w_counter._total_calls += 1
22-
23-
if current_caller in fn_w_counter._call_registry:
24-
fn_w_counter._call_registry[current_caller] += 1
18+
if not hasattr(fn_w_counter,'_call_counter'):
19+
fn_w_counter._call_counter = 0
20+
fn_w_counter._caller_dict = {}
21+
caller = __name__
22+
fn_w_counter._call_counter += 1
23+
if caller in fn_w_counter._caller_dict:
24+
fn_w_counter._caller_dict[caller] += 1
2525
else:
26-
fn_w_counter._call_registry[current_caller] = 1
27-
28-
return fn_w_counter._total_calls, fn_w_counter._call_registry
26+
fn_w_counter._caller_dict[caller] = 1
27+
return fn_w_counter._call_counter,fn_w_counter._caller_dict

0 commit comments

Comments
 (0)