Skip to content

Commit 426a892

Browse files
authored
Merge pull request #805 from beyzasaridas/patch-10
Create functions_beyza_saridas.py
2 parents 88216ea + 89fe948 commit 426a892

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Diff for: Week04/functions_beyza_saridas.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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 calculates a custom equation that.
6+
7+
:param x: Positional-only parameter, default value is 0.
8+
:param y: Positional-only parameter, default value is 0.
9+
:param a: Exponent for `x`, default value is 1.
10+
:param b: Exponent for `y`, default value is 1.
11+
:param c: Divisor of the equation, default value is 1.
12+
13+
:type x: int
14+
:type y: int
15+
:type a: int
16+
:type b: int
17+
:type c: int
18+
19+
:return: The result of the custom equation ((x^a)+(y^b))/c.
20+
:rtype: float
21+
"""
22+
return (x**a + y**b) / c
23+
24+
25+
def fn_w_counter() -> (int, dict[str, int]):
26+
if not hasattr(fn_w_counter, "call_counter"):
27+
fn_w_counter.call_counter = 0
28+
fn_w_counter.caller_counts = {}
29+
30+
caller = __name__
31+
fn_w_counter.call_counter += 1
32+
33+
if caller not in fn_w_counter.caller_counts:
34+
fn_w_counter.caller_counts[caller] = 1
35+
else:
36+
fn_w_counter.caller_counts[caller] += 1
37+
38+
return fn_w_counter.call_counter, fn_w_counter.caller_counts

0 commit comments

Comments
 (0)