All Problems
hardFunctions

Decorator for Execution Time

Problem Statement
Create a decorator that measures the execution time of a function. Apply it to a function that sums numbers from 1 to n.

SAMPLE INPUT

1000000

SAMPLE OUTPUT

Sum: 500000500000
Execution time: 0.0312s

CONSTRAINTS

  • 1 <= n <= 10^8

Explanation: Use time module to measure before and after function execution.

Code Editor
Output
Click "Run" to see output...