✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
What is the primary purpose of the decorator below?
import timedef timer(func): def wrapper(*args, **kwargs): start_time = time.time() result = func(*args, **kwargs) end_time = time.time() print(f"{func.__name__} took {end_time - start_time:.2f} seconds to run.") return result return wrapper@timerdef slow_function(): time.sleep(2) print("Function execution completed.")slow_function()
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!