Skip to content

Commit e967746

Browse files
authored
Initializing new project
1 parent 6adfd09 commit e967746

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Pomodoro Timer/pomodoro.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import time
2+
3+
def countdown(minutes):
4+
seconds = minutes * 60
5+
while seconds:
6+
mins, secs = divmod(seconds, 60)
7+
timer = f'{mins:02d}:{secs:02d}'
8+
print(timer, end='\r')
9+
time.sleep(1)
10+
seconds -= 1
11+
print('Time is up!')
12+
13+
# Example usage:
14+
countdown(1) # for a 25-minute work session
15+
countdown(1) # for a 5-minute break

0 commit comments

Comments
 (0)