Skip to content

Commit

Permalink
Merge pull request #183 from buraxta/patch-3
Browse files Browse the repository at this point in the history
Create functions_burak_gulluler.py
  • Loading branch information
canbula committed Oct 23, 2023
2 parents 1b95660 + 0ffed9b commit f7a8f3b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Week03/functions_burak_gulluler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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:
"""
a function that takes 5 arguments, 2 of which are optional, and returns a float
:param x: (int) first value
:param y: (int) second value
:param a: (int) first exponent
:param b: (int) second exponent
:param c: (int) divisor
:return: (float) result of the equation
"""
return (x**a + y**b) / c




def fn_w_counter() -> (int, dict[str, int]):
# Get the caller's name
caller = globals()['__name__']

# Initialize counters if they don't exist
if not hasattr(fn_w_counter, 'call_counter'):
fn_w_counter.call_counter = 0
fn_w_counter.caller_counts = {}

# Increment the call counter
fn_w_counter.call_counter += 1

# Increment the caller-specific counter
if caller in fn_w_counter.caller_counts:
fn_w_counter.caller_counts[caller] += 1
else:
fn_w_counter.caller_counts[caller] = 1

# Return the results
return fn_w_counter.call_counter, fn_w_counter.caller_counts

0 comments on commit f7a8f3b

Please sign in to comment.