|
| 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 | + Computes a custom equation based on the given parameters. |
| 6 | +
|
| 7 | + The equation is defined as: (x**a + y**b) / c |
| 8 | +
|
| 9 | + :param x : The base value for the first term, default is 0. |
| 10 | + :param y : The base value for the second term, default is 0. |
| 11 | + :param a : The exponent for the first term, default is 1. |
| 12 | + :param b : The exponent for the second term, default is 1. |
| 13 | + :param c : The divisor for the equation, default is 1. |
| 14 | + :return : The result of the custom equation. |
| 15 | + """ |
| 16 | + return (x**a + y**b) / c |
| 17 | + |
| 18 | + |
| 19 | +def fn_w_counter()->(int, dict[str,int]): |
| 20 | + """ |
| 21 | + This function tracks how many times it has been called and returns this count, |
| 22 | + along with the name of the module from which it was called. |
| 23 | +
|
| 24 | + :return: A tuple containing the current call count (int) and a dictionary |
| 25 | + where the module name (str) is the key and the call count (int) is the value. |
| 26 | + """ |
| 27 | + if not hasattr(fn_w_counter, "counter"): |
| 28 | + fn_w_counter.counter = 0 |
| 29 | + fn_w_counter.counter += 1 |
| 30 | + module_name = __name__ |
| 31 | + call_counter_dict = {module_name: fn_w_counter.counter} |
| 32 | + |
| 33 | + return fn_w_counter.counter, call_counter_dict |
| 34 | + |
0 commit comments