Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Pomodoro Timer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Pomodoro Timer

A simple, customizable command line pomodoro timer built in Python.

## Features

- Customizable work, short and long breaks intervals: Define your own durations for each cycle.
- Cycles: Run Multiple cycles of work and break intervals
- Console output: Show work and break intervals in the console.

## How it works

The Pomodoro Timer follow these steps:
1. Set your work and break intervals.
2. Take a short break every work interval.
3. After a set number of cycles, take a long break.

## Usage

1. Clone this repository to your machine.
2. Run the Python script from the command line.
'''python pomodoro_timer.py'''

## Author

[MeuHubPython](https://github.com/MeuHubPython)

31 changes: 31 additions & 0 deletions Pomodoro Timer/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import time


def countdown(minutes, label):
total_seconds = minutes * 60
while total_seconds:
minutes, seconds = divmod(total_seconds, 60)
timer = f"{minutes:02d}:{seconds:02d}"
print(f"{label} Timer: {timer}", end="\r")
time.sleep(1)
total_seconds -= 1
print(f"\n{label} finished!")


def pomodoro_timer(work_min, short_break_min, long_break_min, cycles):
for i in range(cycles):
print(f"\nCycle {i+1} of {cycles}")
countdown(work_min, "Work")
if i < cycles - 1:
countdown(short_break_min, "Short Break")
else:
countdown(long_break_min, "Long Break")


if __name__ == "__main__":
work_minutes = int(input("Enter work interval in minutes: "))
short_break_minutes = int(input("Enter short break interval in minutes: "))
long_break_minutes = int(input("Enter long break interval in minutes: "))
cycles = int(input("Enter the number of cycles: "))

pomodoro_timer(work_minutes, short_break_minutes, long_break_minutes, cycles)
1 change: 1 addition & 0 deletions Pomodoro Timer/runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Python 3.10.12