Skip to content

Commit d504e70

Browse files
committed
PCC52 gwenllian1136
1 parent 9786701 commit d504e70

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

52/gwenllian1136/Pomodoro.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# countdown alarm
2+
# set a time e.g. 20 minutes, counts down and then alarm
3+
4+
from datetime import datetime
5+
from datetime import timedelta
6+
import time
7+
8+
counter_str=input("How many mins to you want to count down ?")
9+
counter=int(counter_str)
10+
11+
if counter<=0:
12+
counter=1
13+
now_time=datetime.today()
14+
the_gap=timedelta(minutes=counter)
15+
Alarm_time=now_time+the_gap
16+
17+
print('Start time is '+datetime.now().strftime('%H:%M:%S'))
18+
while datetime.now()<Alarm_time:
19+
time.sleep(1)
20+
21+
print('It''s '+ Alarm_time.strftime('%H:%M:%S')+ '. Please Stop!')

challenges

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 9786701d6597f9370304926e1a6a45266549069c

0 commit comments

Comments
 (0)