AssignmentsWeek 03 · Data and the outside worldDays-until-the-deadline countdown
wk03.p5Practice exerciseWeek 03 · Data and the outside worldOpen · due this week

Days-until-the-deadline countdown

Use the datetime box to answer a question that's tedious by hand: how many days until an application closes? Subtract one date from another and let Python count for you.

What you'll build

Use the datetime box to answer a question that's tedious by hand: how many days until an application closes? Subtract one date from another and let Python count for you.

Requirements

The must-do parts. If any are missing, we'll ask you to take another pass.

  1. Import the date tool with from datetime import date at the top of the cell.
  2. Build a deadline with date(year, month, day) and get today's date with date.today().
  3. Work out the gap by subtracting today from the deadline, then read the number of whole days with .days.
  4. Print a clear sentence, e.g. 73 days until the deadline.
Bonus, if you're feeling brave
  • Wrap it in your own function days_until(deadline) that takes a date and returns the number of days, so you can reuse it for several deadlines.
  • Keep a list of two or three deadlines and loop your function over all of them, printing a countdown for each.

Examples

What your program should look like when it runs. Lines starting with $ are typed by you; the rest is your program.

Example cell runs (the number depends on the day you run it)
73 days until the deadline.

Where to start

Copy this scaffold into a new file. You don't have to use it — it's just a friendly nudge.

# Days-until-the-deadline countdown
from datetime import date

# TODO: set the application deadline as a date(year, month, day)
deadline = date(2026, 9, 1)

# TODO: get today's date with date.today()

# TODO: subtract today from the deadline, then read .days

# TODO: print a sentence like "73 days until the deadline."

How we'll grade it

Four checks, four points. Three or above is passing — we'll ask you to revise anything we can't tick.

CheckWhat we look forPt
It runsImports cleanly and prints a countdown sentence without errors.1
Uses datetimeThe deadline and today's date are real `date` objects, and the gap comes from subtracting them — not from arithmetic on plain numbers.1
Reads the day countThe number of days is pulled out with `.days` from the subtraction, not guessed or hard-coded.1
Reads wellThe output is a clear, full sentence that names the number of days.1
Ready?
Hand it in
You can submit a draft and revise later if you're not done.
Begin submission →