Skip to content
CampusEduX

Problem 3: Use a Magic Command to Time Code Execution

Easypython
Learn the Concept: Jupyter Notebook

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.

Related Problems

  • Problem 1: Build a Simple Multi-Cell Notebook
    Easy · python
    Solve Problem
  • Problem 2: Demonstrate Out-of-Order Execution Confusion
    Easy · python
    Solve Problem
  • Problem 4: Restart and Run All to Verify Reproducibility
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...