Skip to content

Commit c3d2f88

Browse files
authored
Merge pull request #699 from Yummy0945/patch-6
Create functions_yagmur_tokdemir.py
2 parents 5a3694c + 9a3be60 commit c3d2f88

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
26+
def fn_w_counter()->(int, dict[str, int]):
27+
"""
28+
This funtion counts the how many times it is called and from which caller it is called.
29+
30+
:rtype: tuple(int, dict[str, int])
31+
"""
32+
if not hasattr(fn_w_counter, "count"):
33+
setattr(fn_w_counter,"count",0)
34+
setattr(fn_w_counter,"caller_dict",{})
35+
36+
37+
fn_w_counter.count += 1
38+
caller= __name__
39+
40+
if caller not in fn_w_counter.caller_dict:
41+
fn_w_counter.caller_dict[caller] = 0
42+
43+
fn_w_counter.caller_dict[caller] += 1
44+
45+
return (int(fn_w_counter.count),dict(fn_w_counter.caller_dict))

0 commit comments

Comments
 (0)