|
1 |
| -custom_power = lambda x=0, /, e=1: x ** e |
| 1 | +custom_power= lambda x=0,/,e=1: x**e |
2 | 2 |
|
3 |
| -def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float: |
| 3 | +def custom_equation(x:int=0,y:int=0,/,a:int=1,b:int=1,*,c:int=1)->float: |
4 | 4 | """
|
5 |
| - Calculate the result of the equation (x**a + y**b) / c. |
6 |
| -
|
7 |
| - :param x: Positional-only integer with default value 0 |
8 |
| - :param y: Positional-only integer with default value 0 |
9 |
| - :param a: Positional-or-keyword integer with default value 1 |
10 |
| - :param b: Positional-or-keyword integer with default value 1 |
11 |
| - :param c: Keyword-only integer with default value 1 |
12 |
| - :return: A float that is the result of the equation (x**a + y**b) / c |
| 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 |
13 | 21 | """
|
14 | 22 | return (x**a + y**b) / c
|
15 | 23 |
|
16 |
| -def fn_w_counter(): |
17 |
| - fn_w_counter.counter += 1 |
18 |
| - if not hasattr(fn_w_counter, 'call_dict'): |
19 |
| - fn_w_counter.call_dict = {} |
20 | 24 |
|
21 |
| - caller = '__main__' |
22 |
| - if caller in fn_w_counter.call_dict: |
23 |
| - fn_w_counter.call_dict[caller] += 1 |
24 |
| - else: |
25 |
| - fn_w_counter.call_dict[caller] = 1 |
| 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 = {} |
26 | 29 |
|
27 |
| - return fn_w_counter.counter, fn_w_counter.call_dict |
| 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 |
28 | 37 |
|
| 38 | + return fn_w_counter.call_counter, fn_w_counter.caller_counts |
0 commit comments