Skip to content
Closed
Show file tree
Hide file tree
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
30 changes: 30 additions & 0 deletions days/01-03-datetimes/my_code/helpers.py
Original file line number Diff line number Diff line change
@@ -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)
55 changes: 55 additions & 0 deletions days/01-03-datetimes/my_code/program.py
Original file line number Diff line number Diff line change
@@ -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()
1 change: 1 addition & 0 deletions days/01-03-datetimes/my_code/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
progressbar2