Skip to content

Commit be13e5a

Browse files
authored
Create functions_bahri_un.py
1 parent fe4037f commit be13e5a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Week03/functions_bahri_un.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
custom_power =lambda x=0, /,e=1 ,:x**e
2+
3+
4+
def custom_equation(x: int =0, y: int=0, /, a: int=1, b: int=1, *, c: int=1 ) -> float :
5+
"""
6+
This function computes the result by raising x to the power of a,
7+
adding y to the power of b,
8+
and dividing this sum by c,
9+
returning the result as a floating-point number.
10+
11+
:param x : 1st Number
12+
:param y : 2nd Number
13+
:param a : 3rd Number
14+
:param b : 4th Number
15+
:param c : 5th Number
16+
:return: resulting as a floating-point number.
17+
"""
18+
return float((x**a + y**b ) / c)
19+
def fn_w_counter() -> (int, dict[str, int]):
20+
if not hasattr(fn_w_counter, "call_counter"):
21+
fn_w_counter.call_counter=0
22+
fn_w_counter.caller_counts={}
23+
24+
caller_name = __name__
25+
fn_w_counter.call_counter += 1
26+
27+
if caller_name in fn_w_counter.caller_counts:
28+
fn_w_counter.caller_counts[caller_name] += 1
29+
30+
else:
31+
fn_w_counter.caller_counts[caller_name] = 1
32+
33+
return fn_w_counter.call_counter, fn_w_counter.caller_counts

0 commit comments

Comments
 (0)