Skip to content

Commit 9b669cd

Browse files
authored
Implement custom power and equation functions
Added custom power and equation functions with call counter.
1 parent f083b29 commit 9b669cd

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎Week04/functions_kerimcan_dede.py‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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 does arithmetic opearations.
6+
7+
:param1: first number to be exponantiated
8+
:param2: second number to be exponantiated
9+
:param3: power of the first number
10+
:param4: power of the second number
11+
:param5: divisor of sum of exponantiated numbers
12+
13+
:result: division the sum of exponantiated numbers
14+
"""
15+
return (x**a + y**b) / c
16+
17+
call_counter = 0
18+
caller_dict = {}
19+
def fn_w_counter() -> (int, dict):
20+
caller = __name__
21+
global call_counter
22+
call_counter += 1
23+
if caller in caller_dict:
24+
caller_dict[caller] += 1
25+
else:
26+
caller_dict[caller] = 1
27+
return call_counter, caller_dict

0 commit comments

Comments
 (0)