diff --git a/days/01-03-datetimes/my_code/helpers.py b/days/01-03-datetimes/my_code/helpers.py new file mode 100644 index 00000000..e2f83b72 --- /dev/null +++ b/days/01-03-datetimes/my_code/helpers.py @@ -0,0 +1,30 @@ +# ------------------------------------------------------------------------ +# Helper file for 100 Days of Code +# +# My first 'libaray' code +# +# Brent Gawryluik +# 2018-07-09 +# ------------------------------------------------------------------------ + + +def print_header(title): + + border_length = len(title) + 12 + + print() + print_border(border_length) + print_title(title) + print_border(border_length) + print() + +def print_border(length): + for _ in range(length): + print('-', end='', flush=True) + + print() + + +def print_title(title): + print(' ', end='', flush=True) + print(title) diff --git a/days/01-03-datetimes/my_code/program.py b/days/01-03-datetimes/my_code/program.py new file mode 100644 index 00000000..0a8ef72d --- /dev/null +++ b/days/01-03-datetimes/my_code/program.py @@ -0,0 +1,55 @@ +# ------------------------------------------------------------------------ +# 100 Days of Code +# Day 1-3 +# +# Pomadaro Timer +# - Playing with Datetimes... +# - or time, anyway... +# +# Brent Gawryluik +# 2018-07-09 +# ------------------------------------------------------------------------ + +import helpers +import progressbar +import time + + +def main(): + helpers.print_header('Pomadaro Timer') + work_duration = get_duration_input("WORK") + rest_duration = get_duration_input("REST") + display_timer(work_duration, 'WORK') + display_timer(rest_duration, 'REST') + print() + print('Exiting the Pomadaro timer process.') + + +def get_duration_input(activity): + return int(input("Please enter a number for how many minutes you would like to {}: ".format(activity))) + + +def display_timer(duration, activity): + + print() + print("Starting new {} task".format(activity)) + + if duration == 1: + print("Now displaying {} timer for {} minute...".format(activity, duration)) + elif duration > 1: + print("Now displaying {} timer for {} minutes...".format(activity, duration)) + + print () + + bar = progressbar.ProgressBar(widgets=[ + progressbar.Bar(), + ]) + + for i in bar(range(duration *60)): + time.sleep(1) + + print() + print("{} task is done".format(activity)) + +if __name__ == '__main__': + main() diff --git a/days/01-03-datetimes/my_code/requirements.txt b/days/01-03-datetimes/my_code/requirements.txt new file mode 100644 index 00000000..d8585bae --- /dev/null +++ b/days/01-03-datetimes/my_code/requirements.txt @@ -0,0 +1 @@ +progressbar2