Problem 3: Use a Magic Command to Time Code Execution
Easypython
Problem Description
Create a notebook cell that uses the %timeit magic command to measure how long it takes to sum a list of 1 million numbers.
Input
None (a list of 1 million numbers, generated within the cell).
Output
The timing result reported by %timeit.
Constraints
- Use Python's built-in
sum()function.
Example Input
text(No external input needed)
Example Output
text(A timing report, e.g., "10.2 ms ± 0.5 ms per loop")
Concepts Covered
%timeit magic command.