From acc661a7845b45922e7c04a6a2b9dc9d55d4a787 Mon Sep 17 00:00:00 2001 From: Alex Arazawa Date: Sun, 26 Apr 2020 19:29:28 -0700 Subject: [PATCH 1/3] pomodoro.py file created --- days/01-03-datetimes/code/pomodoro.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 days/01-03-datetimes/code/pomodoro.py diff --git a/days/01-03-datetimes/code/pomodoro.py b/days/01-03-datetimes/code/pomodoro.py new file mode 100644 index 00000000..e3f4375e --- /dev/null +++ b/days/01-03-datetimes/code/pomodoro.py @@ -0,0 +1,3 @@ +from datetime import datetime + +print(datetime.today()) \ No newline at end of file From 9d9fc41adbb1a6fdc5550c1af441e533f3a7316b Mon Sep 17 00:00:00 2001 From: aarazawa Date: Sun, 26 Apr 2020 19:42:53 -0700 Subject: [PATCH 2/3] Update pomodoro.py --- days/01-03-datetimes/code/pomodoro.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/days/01-03-datetimes/code/pomodoro.py b/days/01-03-datetimes/code/pomodoro.py index e3f4375e..b50ec87d 100644 --- a/days/01-03-datetimes/code/pomodoro.py +++ b/days/01-03-datetimes/code/pomodoro.py @@ -1,3 +1,4 @@ from datetime import datetime -print(datetime.today()) \ No newline at end of file +print(datetime.today()) +print('this was updated') From 00289914bb413b1db3ae3bbceaaeea80f921c919 Mon Sep 17 00:00:00 2001 From: alex arazawa Date: Sun, 10 May 2020 01:26:46 -0700 Subject: [PATCH 3/3] Pomodoro timer created --- days/01-03-datetimes/code/pomodoro.py | 29 +++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/days/01-03-datetimes/code/pomodoro.py b/days/01-03-datetimes/code/pomodoro.py index b50ec87d..0f2b88f5 100644 --- a/days/01-03-datetimes/code/pomodoro.py +++ b/days/01-03-datetimes/code/pomodoro.py @@ -1,4 +1,29 @@ from datetime import datetime +import time -print(datetime.today()) -print('this was updated') + +def pom(work, rest, rounds): + for i in range(1, rounds+1): + print(f'Round Number: {i}') + pom_timer(work, 'Work') + pom_timer(rest, 'Rest') + + +def pom_timer(mins, round_str): + start = datetime.today() + remaining = round(mins * 60 - (datetime.today() - start).total_seconds()) + + while remaining > 0: + print(f'\r{round_str} - Time Remaining: {int(remaining / 60):02d}:{int(remaining % 60):02d}', end='') + time.sleep(1) + remaining = round(mins * 60 - (datetime.today() - start).total_seconds()) + + print(f'\r{round_str} - Time Remaining: {int(remaining / 60):02d}:{int(remaining % 60):02d}') + + +def main(work=25, rest=5, rounds=4): + pom(work, rest, rounds) + + +if __name__ == '__main__': + main()