Skip to content

Latest commit

 

History

History
107 lines (70 loc) · 2.11 KB

phase-05.md

File metadata and controls

107 lines (70 loc) · 2.11 KB

Phase 05: Download in serial (10 minutes)

Goal

Use the CSV reader from Phase 04 to download all videos one by one and save a simple Markdown report.

Steps

  1. Import the CSV-reading function from solutions/library.py.
  2. Read the URLs from data/video_urls.csv.
  3. Download each video one by one.
  4. Measure the time for each download.
  5. Measure the total execution time.
  6. Create a simple Markdown report file manually inside the reports/ folder.
  7. Add a short time and space complexity note to the Markdown report.

Use the CSV reader

Your solutions/main.py should use the function you created in Phase 04:

import ...

if __name__ == "__main__":
    ...

Measure time

Use time.perf_counter():

import time

start = time.perf_counter()

# code to time goes here

end = time.perf_counter()
elapsed = end - start

Use round() to show the time with 2 decimal points:

serial_time = round(elapsed, 2)
print(f"Serial execution: {serial_time}")

Your terminal output should look like this:

Serial execution: XX.XX

Create a simple Markdown report

First, manually create a new Markdown file inside the reports/ folder.

Suggested filename:

reports/sequential_report.md

Add this starter content to the file:

# Report

## Serial execution

Total time:

After the file exists, update your Python code so it writes the real serial execution time into this Markdown file.

Also update the report with a short answer to this question:

What is the time complexity and space complexity of downloading the videos one by one?

Add your answer below the serial execution time:

## Complexity

Time complexity:
Space complexity:

Checkpoint

Run:

python solutions/main.py

Confirm that:

  • The app reads URLs using the function from solutions/library.py.
  • Videos download one by one. Check the videos/ folder.
  • A report appears in reports/sequential_report.md.
  • The report includes a short time and space complexity note.
  • The terminal prints Serial execution: XX.XX with the time rounded to 2 decimal points.