3
Given a constraint to do at least 7 hours of work per day, how many actual
4
days of work you did in a given week?
10
time_rx = re.compile(r'(\d+) hours?,? (\d+) min$'
18
h1, m1, h2, m2 = m.groups()
19
return int(h1 or h2 or '0') * 60 + int(m1 or m2 or '0')
25
return '%d hour%s, %d min' % (h, h != 1 and "s" or "", m)
27
return '%d hour%s' % (h, h != 1 and "s" or "")
33
for line in fileinput.input():
34
if line.startswith('Total work done this week:'):
35
work_in_minutes = parse_time(line.split(':', 1)[1].strip())
36
assert work_in_minutes is not None
45
avg_day_len = work_in_minutes / work_days
46
if avg_day_len >= 6 * 60 + 50:
51
return ("%.1f" % f).replace(".0", "")
52
print " Days off: %s" % fmt(days_off)
53
print " Work days: %s" % fmt(work_days)
54
print " Average day length: %s" % format_time(avg_day_len)
57
if __name__ == '__main__':