From f90fb23115db0c8a1f71f23ebf7b841582f74b4b Mon Sep 17 00:00:00 2001 From: Maksym Medvedskyi Date: Tue, 2 Jun 2026 18:10:59 +0300 Subject: [PATCH] My result --- app/main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index 68287892f..75e66928c 100644 --- a/app/main.py +++ b/app/main.py @@ -1,6 +1,15 @@ -from typing import Callable +from typing import Callable, Any def cache(func: Callable) -> Callable: - # Write your code here - pass + result = {} + + def inner(*args) -> Any: + if args in result: + print("Getting from cache") + return result[args] + print("Calculating new result") + res = func(*args) + result[args] = res + return res + return inner