Swift Scheduling

From Exercism PythonMITOriginal pagePython1 class period1 exercise17 graded tests

README.md

Swift Scheduling

Introduction

This week, it is your turn to take notes in the department's planning meeting. In this meeting, your boss will set delivery dates for all open work items. Annoyingly, instead of specifying the actual delivery dates, your boss will only describe them in an abbreviated format. As many of your colleagues won't be familiar with this corporate lingo, you'll need to convert these delivery date descriptions to actual delivery dates.

Instructions

Your task is to convert delivery date descriptions to actual delivery dates, based on when the meeting started.

There are two types of delivery date descriptions:

  1. Fixed: a predefined set of words.
  2. Variable: words that have a variable component, but follow a predefined set of patterns.
Fixed delivery date descriptions

There are three fixed delivery date descriptions:

  • "NOW"
  • "ASAP" (As Soon As Possible)
  • "EOW" (End Of Week)

The following table shows how to translate them:

DescriptionMeeting startDelivery date
"NOW"-Two hours after the meeting started
"ASAP"Before 13:00Today at 17:00
"ASAP"After or at 13:00Tomorrow at 13:00
"EOW"Monday, Tuesday, or WednesdayFriday at 17:00
"EOW"Thursday or FridaySunday at 20:00
Variable delivery date descriptions

There are two variable delivery date description patterns:

  • "<N>M" (N-th month)
  • "Q<N>" (N-th quarter)
DescriptionMeeting startDelivery date
"<N>M"Before N-th monthAt 8:00 on the first workday of this year's N-th month
"<N>M"After or in N-th monthAt 8:00 on the first workday of next year's N-th month
"Q<N>"Before or in N-th quarterAt 8:00 on the last workday of this year's N-th quarter
"Q<N>"After N-th quarterAt 8:00 on the last workday of next year's N-th quarter

Note

A workday is a Monday, Tuesday, Wednesday, Thursday, or Friday.

A year has four quarters, each with three months:

  1. January/February/March
  2. April/May/June
  3. July/August/September
  4. October/November/December.

Open the 01 folder and edit main.py. Run Tests checks it.

For teachers

Swift Scheduling

Students solve Exercism's “Swift Scheduling” Python exercise in CS Room, with Exercism's own tests.

  • Time: 1 class period
  • Tests: 17, set up for you when you import the lesson