Skip to content

Add a single-line countdown timer #21

Description

@utk2103

Add a countdown timer that updates on a single line in the terminal.

Why

Tiny script, two new ideas: time.sleep for pacing, and \r + flush=True to overwrite a line instead of spamming 300 lines of output. Everyone's first timer prints a new line every second — this one shouldn't.

Suggested file

scripts/countdown_timer.py

What it should do

  • Usage: python scripts/countdown_timer.py 90 or python scripts/countdown_timer.py 1:30
  • Display MM:SS counting down in place, then print a finish message and beep (print("\a")).

Acceptance criteria

  • Single-line update using \r and end="", flush=True — not one line per tick.
  • Accepts plain seconds and MM:SS format.
  • Ctrl+C prints the remaining time and exits cleanly, no traceback.
  • Standard library only (time, argparse).

Inspiration

Countdown from Awesome-Python-Scripts.

Good first issue — comment below to get assigned.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions