Skip to content

Commit

Permalink
Merge pull request #81 from selvanurKirac/patch-3
Browse files Browse the repository at this point in the history
Create functions_selvanur_kirac.py
  • Loading branch information
canbula authored Mar 13, 2024
2 parents 24f27eb + 2076ab0 commit a35cc10
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Week03/functions_selvanur_kirac.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
custom_power = lambda x = 0, /, e = 1: x**e

def custom_equation(x : int = 0, y: int = 0, /, a : int = 1, b : int = 1, *, c : int = 1) -> float:
"""
This function adds power a of variable x and power b of variable y. Divides the result by variable c.
:param x: First base
:param y: Second base
:param a: First exponent
:param b: Second exponent
:param c: Divisior number
:return: Returns the result of the operation as a float
"""
return (x**a + y**b) / c


def fn_w_counter() -> (int, dict[str, int]):

caller_name = globals()['__name__']

if not hasattr(fn_w_counter, "call_counter"):
fn_w_counter.call_counter = 0
fn_w_counter.caller_counts = {}

fn_w_counter.call_counter += 1

if caller_name in fn_w_counter.caller_counts:
fn_w_counter.caller_counts[caller_name] += 1
else:
fn_w_counter.caller_counts[caller_name] = 1

return fn_w_counter.call_counter, fn_w_counter.caller_counts

0 comments on commit a35cc10

Please sign in to comment.