Skip to content

Commit

Permalink
fixed according to the mentor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mykola-Osolinskyi committed Dec 4, 2024
1 parent 5e06f1e commit cb435e7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ def cache(func: Callable) -> Callable:
history = {}

def wrapper(*args) -> Callable:
if isinstance(args, (int, float, str, tuple)):
if args in history:
print("Getting from cache")
return history[args]
else:
result = func(*args)
print("Calculating new result")
history[args] = result
return result
if args in history:
print("Getting from cache")
result = history[args]
else:
result = func(*args)
print("Calculating new result")
history[args] = result

return result

return wrapper

0 comments on commit cb435e7

Please sign in to comment.