Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCC52 #809

Open
wants to merge 1 commit into
base: community
Choose a base branch
from
Open

PCC52 #809

Changes from all commits
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
21 changes: 21 additions & 0 deletions 52/gwenllian1136/Pomodoro.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# countdown alarm
# set a time e.g. 20 minutes, counts down and then alarm

from datetime import datetime
from datetime import timedelta
import time

counter_str=input("How many mins to you want to count down ?")
counter=int(counter_str)

if counter<=0:
counter=1
now_time=datetime.today()
the_gap=timedelta(minutes=counter)
Alarm_time=now_time+the_gap

print('Start time is '+datetime.now().strftime('%H:%M:%S'))
while datetime.now()<Alarm_time:
time.sleep(1)

print('It''s '+ Alarm_time.strftime('%H:%M:%S')+ '. Please Stop!')