|
| 1 | +custom_power = lambda x = 0, /, e = 1: x ** e |
| 2 | + |
| 3 | + |
| 4 | +def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float: |
| 5 | + """ |
| 6 | + This function raises x to the power of a, y to the power of b, sums them, and then divides the result by c. |
| 7 | +
|
| 8 | + :param x: The positional-only integer base parameter for the equation , default is 0 |
| 9 | + :param y: The positional-only integer base parameter for the equation , default is 0 |
| 10 | + :param a: The positional-or-keyword integer exponent parameter for the equation , default is 1 |
| 11 | + :param b: The positional-or-keyword integer exponent parameter for the equation , default is 1 |
| 12 | + :param c: The keyword-only integer divisor parameter for the equation , default is 1 |
| 13 | + :return: The result of the calculation as a float and the equation is (x**a + y**b) / c |
| 14 | + :rtype: float |
| 15 | + """ |
| 16 | + return (x**a + y**b) / c |
| 17 | + |
| 18 | + |
| 19 | +def fn_w_counter() -> (int, dict[str, int]): |
| 20 | + if not hasattr(fn_w_counter,'_call_counter'): |
| 21 | + fn_w_counter._call_counter = 0 |
| 22 | + fn_w_counter._caller_dict = {} |
| 23 | + caller = __name__ |
| 24 | + fn_w_counter._call_counter += 1 |
| 25 | + if caller in fn_w_counter._caller_dict: |
| 26 | + fn_w_counter._caller_dict[caller] += 1 |
| 27 | + else: |
| 28 | + fn_w_counter._caller_dict[caller] = 1 |
| 29 | + return fn_w_counter._call_counter,fn_w_counter._caller_dict |
0 commit comments