Week 3

Outdated

Turn a month name into a month number, and ask again when the date is not real.

You type

A date written with a month name.

The tool
A date, or another try Ask for a date If it is not real, ask again again
What comes out

A numeric date, or another prompt.

The question, more slowly

The question is: a date written with a month name comes in, and you print it as a numeric year-month-day. If the date is not a real date in the shape the spec allows, ask again.

You need to turn a month name into a month number, then check that the day could exist in that month. The spec shows the input shapes it accepts, including how the commas work. Stick to those shapes.

People accept February 31, or they swap the day and the month in the output. Write one valid date and one impossible date on paper before you code.

Before you code

Write one real date and one impossible date, such as a 31st of a short month. The spec shows the input shape.