Skip to content

Commit 65b1480

Browse files
authored
Merge pull request #102 from dlrakdenizz/patch-2
Create functions_dilara_akdeniz.py
2 parents 78ffdf0 + a1306b1 commit 65b1480

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Week03/functions_dilara_akdeniz.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
custom_power = lambda x = 0, / , e = 1 : x**e
2+
3+
def custom_equation(x : int = 0, y : int = 0, / , a : int = 1, b: int = 1, * , c : int = 1) -> float:
4+
"""
5+
This function takes 5 arguments, 2 of which are optional, and returns a float
6+
:param x : (int) first value
7+
:param y : (int) second value
8+
:param a : (int) first exponent
9+
:param b : (int) seconda exponent
10+
:param c : (int) divisor
11+
:return (float) result of the equation
12+
"""
13+
return (x**a + y**b) / c
14+
15+
def fn_w_counter() -> (int, dict[str, int]):
16+
if not hasattr(fn_w_counter, "call_counter"):
17+
fn_w_counter.call_counter=0
18+
fn_w_counter.caller_counts={}
19+
20+
caller_name = __name__
21+
fn_w_counter.call_counter += 1
22+
23+
if caller_name in fn_w_counter.caller_counts:
24+
fn_w_counter.caller_counts[caller_name] += 1
25+
26+
else:
27+
fn_w_counter.caller_counts[caller_name] = 1
28+
29+
return fn_w_counter.call_counter, fn_w_counter.caller_counts

0 commit comments

Comments
 (0)