Skip to content

Commit 6ef6d64

Browse files
committed
Added 5 minute and 25 minute timers
1 parent a2166ba commit 6ef6d64

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

100-Days-Projects/Days 1-3-Datetimes/pomodoro.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,35 @@ def countdown(t):
88
timeformat = '{:02d}:{:02d}'.format(mins, secs)
99
print(timeformat, end='\r')
1010
time.sleep(60)
11+
#time.sleep(1) #for testing
1112
t -= 1
12-
13+
count = 0
1314
now = datetime.now()
14-
nowPlusOne = now + timedelta(minutes = 25)
15+
nowPlus25 = now + timedelta(minutes = 25)
1516

1617
nowMinute = now.minute
17-
nowPlusOneMin = nowPlusOne.minute
18+
nowPlus25Min = nowPlus25.minute
1819

19-
while (nowMinute != nowPlusOneMin):
20+
while count <= 4:
21+
while (nowMinute != nowPlus25Min):
22+
print("Break time will be at: " + str(nowPlus25))
23+
countdown(25)
2024
time.sleep(1)
2125
now = datetime.now()
2226
nowMinute = now.minute
23-
print("Break time will be at: " + str(nowPlusOne))
24-
countdown(25)
25-
27+
# if nowMinute == nowPlus25Min:
28+
# break
2629

30+
print("Take a break!")
2731

28-
print("Take a break!")
32+
now = datetime.now()
33+
nowPlusFive = now + timedelta(minutes = 5)
34+
nowPlusFiveMin = nowPlusFive.minute
2935

36+
while (nowMinute != nowPlusFiveMin):
37+
print("Work timer will start at: " + str(nowPlusFive))
38+
countdown(5)
39+
time.sleep(1)
40+
now = datetime.now()
41+
nowMinute = now.minute
42+
count += 1

0 commit comments

Comments
 (0)